[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: ways to avoid (or speed up) luaL_checkudata() in LuaJIT2?
- From: Drake Wilson <drake@...>
- Date: Sun, 7 Nov 2010 11:37:24 -0700
Quoth Mark Hamburg <mark@grubmah.com>, on 2010-11-07 10:15:21 -0800:
> Per the discussions about strings for looking up values, one of my standard Lua utility routines is roughly:
>
> int pushTableForKey( lua_State* L, int sourceIndex, const void* udkey ) {
> // Normalize sourceIndex to avoid problems with relative addresses after the push.
> lua_pushlightuserdata( L, (void*) udkey );
> lua_gettable( L, sourceIndex );
> if( !lua_isnil( L, -1 ) ) return 0;
> lua_pop( L, 1 );
> lua_newtable( L );
> return 1;
> }
Just out of curiosity, do you ever store the new table back into
<table at sourceIndex>[<lightuserdata udkey>]? Was that part omitted
for clarity?
---> Drake Wilson
- References:
- ways to avoid (or speed up) luaL_checkudata() in LuaJIT2?, Stefan Behnel
- Re: ways to avoid (or speed up) luaL_checkudata() in LuaJIT2?, Duncan Cross
- Re: ways to avoid (or speed up) luaL_checkudata() in LuaJIT2?, Stefan Behnel
- Re: ways to avoid (or speed up) luaL_checkudata() in LuaJIT2?, Duncan Cross
- Re: ways to avoid (or speed up) luaL_checkudata() in LuaJIT2?, Stefan Behnel
- Re: ways to avoid (or speed up) luaL_checkudata() in LuaJIT2?, liam mail
- Re: ways to avoid (or speed up) luaL_checkudata() in LuaJIT2?, Leo Razoumov
- Re: ways to avoid (or speed up) luaL_checkudata() in LuaJIT2?, Shawn Fox
- Re: ways to avoid (or speed up) luaL_checkudata() in LuaJIT2?, Drake Wilson
- Re: ways to avoid (or speed up) luaL_checkudata() in LuaJIT2?, Mark Hamburg