File Scoping Lua?
I'm failry new to using Lua in genral, but have looked into embedding. One issue I have encountered is that neither the luabind nor the lua api itself has the ability to call a function in a specific file, one can call a function by name but that has issues if two or more files has a function with the same name. That is something I would like to support however, so is it possible to file-scope lua? I was thinking giving each script file their own luaState in the game itself, am I right in assuming that that would work? Is there any other standard way of doing this?
Executing the contents of a file in a non-global environment might allow you to do this.
Caveat: It has been a while since I used Lua, and environments were handled differently in the older versions, so research the implications fully, don't take my word for it.
Caveat: It has been a while since I used Lua, and environments were handled differently in the older versions, so research the implications fully, don't take my word for it.
Executing the contents of a file in a non-global environment might allow you to do this.
Caveat: It has been a while since I used Lua, and environments were handled differently in the older versions, so research the implications fully, don't take my word for it.
Thank you, I seem to have difficulties changing the current enviroment though.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement