Garry added a new function at some point to the undocumented CLuaShared interface in lua_shared.dll. This function is called GetLuaInterface and takes a uchar id as an argument.
What this means is that we can now get access to the client, server, or menu state from any module on any state without having to hook onto any ILuaInterface functions.
This means that client modules can access the menu state and menu state modules can access the client state freely, without any hooks that may break between updates.
I wrote a basic wrapper class called CStateManager. This class can replace Lua() and the lua_State* info given to you when the module loads.
Note: The client and server interfaces don’t exist until the game loads. Always check to see if client or server are NULL if you are trying to access them at a time where they may not be active.
Download the class here: V1
If your name is Garry Newman, please don’t break this function just because you can, thanks