lua-users home
lua-l archive

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


On Sun, May 1, 2011 at 23:44, Dirk Laurie <dpl@sun.ac.za> wrote:
> On Sun, May 01, 2011 at 09:04:38PM +0200, lin_style wrote:
>> thanks!
> Your subject line was:
>    table.setn was deprecate, what is new function to replace it?

> In Lua 5.2, something like this:

> function setn(t,n)
>    setmetatable(t,{__len=function() return n end})
>    end

But, first, make sure that you still need it.

Alexander.