[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: C string pointers to Lua
- From: Mark Hamburg <mark@...>
- Date: Tue, 12 Oct 2010 19:37:29 -0700
On Oct 12, 2010, at 7:34 AM, Luiz Henrique de Figueiredo wrote:
>>> lua_pushstring(L,s); s=lua_tostring(L,-1)
>> Note that this does not work if you have multiple Lua universes since the string will have different identities in different universes.
> The OP had this:
> const char *arg = lua_tostring (L, 1);
> so the strings come from Lua. But you're right: you have to register
> the strings in each Lua universe you need them.
I wasn't specifically critiquing the new code. Sorry for the misconception. My point was that if you use multiple Lua universes, you end up clobbering your globals and hence the pointer comparisons are a risky design.