I have this script loaded in my C# program
function test()
print ("A")
end
but when I try to invoke it
LuaFunction func = lua.GetFunction("test")
func.call()
I get the problem that func is null.
What do I wrong?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You say you have loaded the
testscript into the C# program. This is not enough. You have to execute the resulting chunk code so that the globaltestvariable gets assigned.Always reminder that
is only a syntactic sugar for:
When Lua loads some code, it just compiles the source code into bytecode.The affectation
test = function() endis only executed at runtime, not at compile time.