-
-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Named functions #22
Comments
Hey use lua.execute() lua.eval() is the same except it places a return statement in front of your expression |
As you can see from the traceback, your actual code duplicates the opening "(" in the function. Thus the error. lua.eval() works fine for defining functions (or any expression, really). It prepends the code with "return ", as fried said. execute() is for running arbitrary code that is not an expression. |
If you really want named functions, you can write
|
Works like a charm thanks a lot. I thought we couldn't reuse what was in "execute" in the same runtime, not sure why. Thanks for the answer and the amazing work ! Cheers |
Hi !
I am using lupa to validate some LUA expressions persisted to a data store from a python webapp. The thing is my expressions contains some custom functions defined elsewhere. I am wondering is there is a way to define them before running the expression I am trying to validate ?
EG:
Here field is a custom function, I am just trying to enforce that the LUA syntax is valid, not execute exactly the whole function so I figured I had to do something like that :
But I keep having this error :
Am I doing something wrong or is this just not possible ?
Thanks a lot
The text was updated successfully, but these errors were encountered: