0 Members and 1 Guest are viewing this topic.
I am a proud cynic.
Which file/folder would we make the example script you showed above in?Then, once we do that, which script do we run to convert to bytecode?
-- let's assume this script is in the \src\ folderlocal mods = require("current"); -- this runs current.lua, which returns a table of the major API functionslocal bytecode = mods.Assemble([[; put cool bytecode here]]); -- this passes the multi-line string argument to Assemble(), which turns it into bytecode-- The easiest way to utilize bytecode in a script is in an escape sequence like so: \104\101\108\108\111 (this is the ASCII sequence "hello")print(bytecode:gsub(".", function(a) return "\\" .. a:byte() end)) -- this is the bytecode in the above format, which you can pass as a string argument to loadstring()
And, finally, how do we run Lua scripts like that on the computer?
Any chance you could make some sort of an API/less confusing and nspire-oriented tutorial?
>lua current.lua input.lasm -o output.lua
The fun part on loadstring is that it return a function, which you will be able to use during the whole script. So if you do everything in the beginning (when you open the script), it should be fine
.options 0, 0, 0, 2getglobal 0, <"print">loadk 1, <"hello world">call 0, 2, 1return 0, 1