Set variable in LuaFunction without using globals #102
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I created a stackoverflow question here:
https://stackoverflow.com/questions/72307489/luaj-set-variable-in-luafunction-without-using-globals
I have a LuaFunction where in I will call the invoke() method and pass in some var-args. I wish to pass some data to this LuaFunction such that it can be referenced by the lua code as if it was a built-in variable.
For example, I want to have a variable named "script". When a script class executes its lua code, and it references the "script" value, I want it to represent that script object, but only for that lua code--I want no other lua code to be able to see this variable.
Currently, I am using Globals via:
Lua code:
While this does work, I can reference "script" in my lua code, this also sets _G.script, which I do not like.
Does anyone have any ideas for this situation?
Still unable to resolve this.