Omnimaga
Calculator Community => TI Calculators => Lua => Topic started by: blauemauritius on August 04, 2013, 03:06:08 pm
-
Hello,
i want to use in a LUA script xpcall(). Does anyone know how? Can i use any function which i have created with the program editor?
Thank you in advance.
blauemauritius
-
Hi,
Why would you use xpcall instead of pcall since on TI-Nspire the "debug" package is not available ?
Anyway, just google-it
http://www.fxcodebase.com/documents/IndicoreSDK/lua/pdf-xpcall.html
http://www.lua.org/pil/8.5.html
Can i use any function which i have created with the program editor?
I don't understand your question (maybe because its answer is obvious) I'm just looking forward finding a deeper problem : do you have any source code ?
-
thank you. I will see what is written in your links.
I will give you a feedback.
-
thank you... Is the call and the structure in LUA for NSpire the same?
Do you have a short example?
-
thank you... Is the call and the structure in LUA for NSpire the same?
Yes, the same. TI did not reinvented the Lua, they only turned it event-based and added their API.
Do you have a short example?
The example given in the second link will work
local status, err = pcall(function () a = 'a'+1 end)
print(err) --> stdin:1: attempt to perform arithmetic on a string value
local status, err = pcall(function () error("my error") end)
print(err) --> stdin:1: my error
-
Thank you. It Looks that i have to write a function between the brackets.
My question was: can i use with pcall or xpcall functions Or procedures which i wrote in TI-basic in the TI program editor?
Thank you for your great support. I hope my english is not too bad.
-
You can call functions (not programs) that you wrote within the Basic Editor, yes.
That's through [lua]math.eval[/lua]
-
Thank you. I will try it tomorrow.
Good night.