I am using NLua for script interface with my application if my application takes multiple files such as one.lua and two.lua
i want to get all the functions in all files in to a list of luafunctions
List<LuaFunctions> Functions;
NLua doesnt seem to have such a feature, but is there a way around it, there is a GetFunction(string) methodthat will return the function that you named, i can ofc do a brute force method on the GetFunction method but that will make my application take hours to start up with.
Any ways to work around this and get all functions in all files to a list of luafunctions?
As functions cannot be listed out of the blue, i found another way around it a couple of hours later.
i listed all functions on a table. so my lua code:
function Start()
// something
end
function Update()
// something else
end
became this:
var main = {}
function main.Start()
// something
end
function main.Update()
// something else
end
that way i could take them from a table listing, using
lua.GetTable({tablename});
which i have written a requirement for has to be named the same as the file so it would become:
var funcList = lua.GetTable(Path.GetFileNameWithoutExtension(c:\main.lua));
that would take and list all functions and then we can use:
lua.GetFunction(funcList[0]).Call();
as an example. Took me a while to find this work-around and i hope it will benefit someone.