lua-users home
lua-l archive

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


Greetings all,

in my test code:

while(1)
{
        lua_pushstring(state,"woot!");

        int ref=lua_ref(state,1);

        lua_unref(state,ref);

        lua_gc(state,LUA_GCCOLLECT,0);
}

I observe ref is returned like this

iteration 1  ref is 1
iteration 2  ref is 1
iteration 3  ref is 2
further iterations increase ref by 1


I assumed that the above code would continually return the same reference id, since i was referencing and releasing the object
which means the id should again be free for use, it seemed to do this on iterations 1 and 2 but on iterations 3 and above the reference count
continues to grow.

can anyone clear up what I might be doing wrong?
or perhaps my assumptions about lua_ref and lua_unref are wrong?

-Raymond Jacobs
Owner
Ethereal Darkness Interactive