lua-users home
lua-l archive

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


On Fri, Nov 07, 2003 at 09:34:18AM -0600, Virgil Smith wrote:
> >Is this the result that everyone else gets?
> Not at all.  I just coded a quick test and my output is...
> 
> GetRef(FuncOne) = 3
> GetRef(FuncOne) = 4
> GetRef(FuncOne) = 5
> GetRef(FuncTwo) = 6
> GetRef(FuncOne) = 7
> GetRef(FuncOne) = 8
> 

me too

int getref(lua_State *L) { lua_pushnumber(L, lua_ref(L, 1)); return 1; }
int unref(lua_State *L) { lua_unref(L, lua_tonumber(L, -1)); return 0; }

---------------------------
bin> ./luaxxx -e"_PROMPT=''" -i <<EOF
> function foo() end
> function bar() end
> =getref(foo)
> =getref(foo)
> =getref(bar)
> =getref(foo)
> unref(3)
> =getref(foo)
> unref(5)
> =getref(bar)
> =getref(foo)
> EOF
3
4
5
6
3
5
7

bin>
---------------------------

-taj