From 284ce493665f4bff07c0019a39353ca4b4ee9faa Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 22 Sep 2006 04:26:43 +0000 Subject: [PATCH] fix FromStack for negative iPos --- stepmania/src/RageTypes.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/stepmania/src/RageTypes.cpp b/stepmania/src/RageTypes.cpp index 4cb8b99773..a0e04d9fc4 100644 --- a/stepmania/src/RageTypes.cpp +++ b/stepmania/src/RageTypes.cpp @@ -19,15 +19,18 @@ void RageColor::PushTable( lua_State *L ) const void RageColor::FromStack( lua_State *L, int iPos ) { - lua_rawgeti( L, iPos, 1 ); + lua_pushvalue( L, iPos ); + int iFrom = lua_gettop( L ); + + lua_rawgeti( L, iFrom, 1 ); r = lua_tonumber( L, -1 ); - lua_rawgeti( L, iPos, 2 ); + lua_rawgeti( L, iFrom, 2 ); g = lua_tonumber( L, -1 ); - lua_rawgeti( L, iPos, 3 ); + lua_rawgeti( L, iFrom, 3 ); b = lua_tonumber( L, -1 ); - lua_rawgeti( L, iPos, 4 ); + lua_rawgeti( L, iFrom, 4 ); a = lua_tonumber( L, -1 ); - lua_pop( L, 4 ); + lua_pop( L, 5 ); } /*