Deprecated. Note that lua_objlen() doesn't actually return the number of elements in the table. It simply evaluates the new # operator which will return the first integer n such that t[n] is not nil and t[n+1] is nil. Note that this means that this is only useful for tables which have no "holes" and integer indexes (starting at 1).
If you really want the table size, you have to walk the whole table (using next() or pairs() in Lua or lua_next() in C).
This commit is contained in:
@@ -93,7 +93,7 @@ ITween *ITween::CreateFromStack( Lua *L, int iStackPos )
|
||||
if( iType == TWEEN_BEZIER )
|
||||
{
|
||||
luaL_checktype( L, iStackPos+1, LUA_TTABLE );
|
||||
int iArgs = luaL_getn( L, iStackPos+1 );
|
||||
int iArgs = lua_objlen( L, iStackPos+1 );
|
||||
if( iArgs != 4 && iArgs != 8 )
|
||||
RageException::Throw( "CreateFromStack: table argument must have 4 or 8 entries" );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user