Omnimaga
Calculator Community => TI Calculators => Lua => Topic started by: Goran on August 23, 2013, 04:47:54 am
-
Hello,
I tried to execute a program from a Lua script, but this seems not to be allowed
(I get Error 580):
local ans,err = math.eval('prog1(<args>)')
print(ans,err)
Originally I wanted to create a function to get result, but then some of the ti math engine functions
were not allowed to be used from within a function (e.g. CopyVar, DelVar).
Then I said I would encapsulate the functionality into a program, which will during its execution create
variables in the symbol table and then I will fetch these variables from my Lua script.
When I run the program directly from e.g. Calculator app, it works as wanted and I have all the variables I want in the symbol table.
But if I try to execute the program using mathEval() function, I end with Error 580.
I feel it's little bit of a "catch 22" situation.
Best regards,
Goran
-
Only functions (not programs) can be executed through math.eval().
Indeed, programs affect the global environnement and do not return a value.
In order to modify the global environnement, please use var.store/recall/list