[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A few questions
- From: Steve Dekorte <steve@...>
- Date: Tue, 06 Jun 2000 13:09:38 -0700
Falko Poiker <fpoiker@relic.com> wrote:
> Is there a way to find out if an index is valid in a table? I tested the
> above, and lua_getnumber returns 0.0 if there isn't anything at that
index.
> Is there something like lua_isindex() ?
rawgettable can do the same thing:
In lua:
function isindex(table)
if rawgettable(table, 1) == nil then
return 0
end
return 1
end
In C:
int lua_isindex(lua_Object table)
{
if ( lua_isnil(lua_rawgettable(table, "1")) == 1 )
{
return 0
}
return 1
}
Steve