lua-users home
lua-l archive

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


>   I'd like to see a generator in the library for lists that doesn't
>   include the index as ipairs does:
>
>     for v in list(t) do ... end

Such generator would have to keep its own state, and so would be more
expensive than `ipairs'...


> * pushfstring/pushvfstring (4.7)
> 
>    Why the restricted custom implementation instead of building these
>    using vsprintf?  Note that LUA_NUMBER_FMT can always be inserted into
>    a static format using C string concatenation.

Memory allocation. With vsprintf, we were always worried about buffer sizes
and the like. Now Lua takes care of all this for us.

Moreover, now the Lua core uses *printf only to implement the macro
lua_number2str. As long as you can give an alternative implementation
for that macro, you don't need *printf in Lua. (Actually, besides that
macro you don't need stdio.h at all in the core.)


> * what happens if a finalizer function leaves a reference to the given
>    object? (3.7.1)

No problems. The finalizer is called only once, and the object is
actually collected only in the next GC cycle. So, if the finalizer
leaves a reference to it, it won't be collected until it becomes garbage
again.

-- Roberto