croizat
[NLua] How to provide the lua state with a dynamically accessible class
I have a
Service
class that contains different services that relate to the game, like Player, WorldState, etc. I want to provide access this class to the lua state in a way where it is newly accessed each time it's called. So not just doing
because that will lead to the values being cached on load, and not accessed whenever they're called in a lua script. The goal is to ultimately be able to just call Service.Player.Position
or Service.WorldState:GetMapName()
(or formatted reasonably similarly) and fetch the value on call.
There are hundreds of functions and properties within the service class so I'm not interested in making wrappers for all of them either and registering them individually. This seems very straightforward to accomplish and that I'm missing someting obvious, but the lack of nlua documentation is getting to me.24 replies