lua-users home
lua-l archive

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


On 10/22/2011 11:32 PM, David Manura wrote:

That's a good question.  The way I see it, we have this table called
"_G".  It contains the standard library, which are functions that
almost all programs frequently use.  Some rare programs might not use
any of it.  Many other programs might not use parts like debug.  Some
sandboxed programs may an alternative table containing a subset of _G
with some wrapped or reimplemented functions.

And that's exactly what my pbLua implementation for LEGO MINDSTORMS
does. I've got a _very_ RAM constrained system so the user can unload
any tables that are not needed. By default you get table, string, bit,
coroutine, and debug as well as the LEGO NXT nxt library functions.

Don't need the coroutine or bit functions?

bit = nil
coroutine = nil

And the next time the gc runs the RAM is recovered. Of course, if you
figure out later that coroutines might be useful, then:

require( "coroutine" )

And you've got them back in the table called "coroutine".

Ralph