lua-users home
lua-l archive

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


> but that isn't a reason to not add them to the language itself.

A language does not grow in a healthy way by adding things for which you
cannot find a reason to omit.

> It can also be done by creating a custom
> allocator but that is messy and costs performance.

There is *no* internal allocator. The one set by luaL_newstate is
a custom allocator. Any performance is gained or lost there.

> 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

This is easy:

debug.setmetatable(nil,{__index=function()end})