lua-users home
lua-l archive

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

On Sat, Jun 25, 2011 at 6:55 PM, HyperHacker <> wrote:
With 5.2 getting so near completion, I feel it's worth bringing up a
couple small enhancement ideas I had in hopes they might be considered
for inclusion in the official release:

While we are wishing for things, I'd still like to see both of these, neither of which is particularly hard to implement.  I understand that I can work around these problems or modify my own copy of Lua, but that isn't a reason to not add them to the language itself.

1) A standard API to limit the amount of memory used by Lua, something like lua_setmaxmemory(L,bytes) and bytes=lua_getmaxmemory(L).  I found this straightforward to add with LuaJIT and it seems to be a fairly common problem that needs to be solved.  It can also be done by creating a custom allocator but that is messy and costs performance.

2) Support for multiple dimensional sparse arrays with proper handling of nil values rather than throwing an error.  This could be done in one of two ways: (A) change the current behavior so that t[x][y][z] will just return nil if t[x][y] is nil and t[x][y][z] = 'abc' would set t[x][y] = {} if t[x][y] was nil or (B) by adding an additional syntax such as t[x,y,z] instead of t[x][y][z] that handles nil values and automatically creates (and deletes) empty tables where necessary.