lua-users home
lua-l archive

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


this forces an allocation for the duplication of the string inside the lua
state, that will be discarded from the stack as soon as the purpose of its
presence is fulfilled: it adds an extra load on the garbage collector.
maybe simply exposing a function n=lua_stringtonumber(s) could do the trick,
and if one wants to put the value on the stack, just call
lua_pushnumber(L,lua_stringtonumber(s)) ?

> -----Original Message-----
> From: Roberto Ierusalimschy [mailto:roberto@inf.puc-rio.br]
> Sent: jeudi 25 juillet 2002 16:36
> To: Multiple recipients of list
> Subject: Re: Proposal: lua_pushsnumber
> 
> 
> What about this?
>   lua_pushstring(L, s);
>   n = lua_tonumber(L, -1);
> 
> -- Roberto
>