To clarify what others have said, Lua is a scripting language designed for embedding. This means that it runs inside another application.
Lua.exe is one such application. But this is not the only application for which Lua scripts can be written to run.
Inside the Lua script, you have access to the exact and only what the application environment allows. If the application clearly does not allow you to access things like “files” or “operating system”, you cannot access them. Period.
The Lua standard library (which the application may forbid to use scripts. Lua.exe allows this, but there are some built-in environments that do not) are very few. It does not offer many of the amenities that make Lua ideal for embedded environments: small standard libraries mean smaller executables. That's why you see a lot more Lua in mobile applications than, say, Python. In addition, the standard library is cross-platform, so it does not have access to platform-specific libraries.
Modules, user programs (in Lua or C / C ++) can be loaded into the Lua.exe environment. Such a module can give your Lua script access to things like "processes", how much memory a process takes, etc. But if you do not have access to such a module, you do not get this information from the Lua script.
The most you can do is get the amount of memory that this Lua environment directly allocates and uses, as @lhf said: collectgarbage "count" .
source share