How do I get the current environment’s globals?

Is it possible to grab all the Roblox and Lua globals in the current environment as a table? Like math, os, game, require, etc.

My first thought was to use getfenv to do this, but:


Just prints a table with only a “script” key.

Any help would be appreciated.


I know this is a really old topic but have you or anyone else found a solution to this problem? I would like to know it too