In a C app when I call a Lua script, do the variables in the code stay with the same value when I call the script again later?
Share
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.
They will still exist in the lua state you created until you close that state. The variables are tied to the state not the script file.
edit
As noted in the comments local variables will be garbage collected when they go out of scope. A further caveat is that Lua supports closures and upvalues so the scope may not always be completely obvious.