Calculator Community > Lua
Nspire - Lua - xpcall
blauemauritius:
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
Levak:
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
--- Quote --- Can i use any function which i have created with the program editor?
--- End quote ---
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 ?
blauemauritius:
thank you. I will see what is written in your links.
I will give you a feedback.
blauemauritius:
thank you... Is the call and the structure in LUA for NSpire the same?
Do you have a short example?
Levak:
--- Quote from: blauemauritius on August 04, 2013, 03:23:33 pm ---thank you... Is the call and the structure in LUA for NSpire the same?
--- End quote ---
Yes, the same. TI did not reinvented the Lua, they only turned it event-based and added their API.
--- Quote ---Do you have a short example?
--- End quote ---
The example given in the second link will work
--- Code: --- 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
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version