lua.cr
lua.cr copied to clipboard
Accessing functions by name (or something?)
Let's say I have a lua file like:
function one()
print("one")
end
function two()
print("two")
end
return one, two
Then I add these to the stack:
lua = Lua.load
code = lua.run File.new("./test.lua")
I can do a secondary run lua.run("one()"), but is there a way to gather these functions individually by a name or something?
What I'm looking to do is call them from within Crystal like one.as(Lua::Function).call. Then I can pass in args from Crystal. I know I can do this if I return a single function, but what if I return multiple functions, and I can't guarantee which order they were returned in?