Forums » Suggestions
Lua - Read access to the sandbox root level table
In Lua, the variable _G allows a programmer to access the root-level table of the environment. This functionality has obviously been removed for reasons partly, I assume, related to security.
While I wouldn't expect the actual _G to be made available, I ask that read access to the sandbox's _G be made available. This would allow us to see all of the functionality available for use in the sandbox. This knowledge may allow us to identify API features that, up-to-now, we have been having to recreate in a more complex and non-portable manner or had to struggle with the lack of a way to implement.
For instance, I recently discovered that there is a function isdeclared() which is a partner to the function declare().
Before this discovery I had to use a custom function utilizing a pcall(). Another similar approach (in the plugin CargoList) was to use declare() to actually instantiate a variable to it's existing value or nil. This of course has the consequence of actually instantiating the variable, so that isdeclared() can't be used in it's intended manner.
While I wouldn't expect the actual _G to be made available, I ask that read access to the sandbox's _G be made available. This would allow us to see all of the functionality available for use in the sandbox. This knowledge may allow us to identify API features that, up-to-now, we have been having to recreate in a more complex and non-portable manner or had to struggle with the lack of a way to implement.
For instance, I recently discovered that there is a function isdeclared() which is a partner to the function declare().
Before this discovery I had to use a custom function utilizing a pcall(). Another similar approach (in the plugin CargoList) was to use declare() to actually instantiate a variable to it's existing value or nil. This of course has the consequence of actually instantiating the variable, so that isdeclared() can't be used in it's intended manner.