lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> is it possible to find the memory usage of a table?

No.


> I assume in low memory situations, the Lua interpreter would throw an
> error when it ran out of memory? (sure other things would grind to a
> halt as well!) I would much rather have the script throw the error and
> have some chance of exiting gracefully.

Low memory situations generate the same kind of error as an error
thrown by the script, except that it does not generate a traceback.
You can catch it as you catch other errors (e.g., with pcall).
Of course, you must be careful not to require more memory to handle
it, or Lua may rethrow the error...

-- Roberto