add Lua::GetStack
lua MonthOfYear: return 1..12 instead of 0..11
This commit is contained in:
@@ -76,6 +76,17 @@ void Lua::PopStack( lua_State *L, CString &out )
|
|||||||
lua_pop( L, -1 );
|
lua_pop( L, -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Lua::GetStack( lua_State *L, int pos, int &out )
|
||||||
|
{
|
||||||
|
if( pos < 0 )
|
||||||
|
pos = lua_gettop(L) - pos - 1;
|
||||||
|
if( pos < 1 )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
out = (int) lua_tonumber( L, pos );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void LoadFromString( lua_State *L, const CString &str )
|
void LoadFromString( lua_State *L, const CString &str )
|
||||||
{
|
{
|
||||||
ChunkReaderData data;
|
ChunkReaderData data;
|
||||||
@@ -171,7 +182,7 @@ LuaFunctionList::LuaFunctionList( CString name_, lua_CFunction func_ )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LuaFunction_NoArgs( MonthOfYear, GetLocalTime().tm_mon );
|
LuaFunction_NoArgs( MonthOfYear, GetLocalTime().tm_mon+1 );
|
||||||
LuaFunction_NoArgs( DayOfMonth, GetLocalTime().tm_mday );
|
LuaFunction_NoArgs( DayOfMonth, GetLocalTime().tm_mday );
|
||||||
LuaFunction_NoArgs( Hour, GetLocalTime().tm_hour );
|
LuaFunction_NoArgs( Hour, GetLocalTime().tm_hour );
|
||||||
LuaFunction_NoArgs( Minute, GetLocalTime().tm_min );
|
LuaFunction_NoArgs( Minute, GetLocalTime().tm_min );
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ namespace Lua
|
|||||||
void PushStack( lua_State *L, void *out );
|
void PushStack( lua_State *L, void *out );
|
||||||
void PushStack( lua_State *L, const CString &out );
|
void PushStack( lua_State *L, const CString &out );
|
||||||
void PopStack( lua_State *L, CString &out );
|
void PopStack( lua_State *L, CString &out );
|
||||||
|
bool GetStack( lua_State *L, int pos, int &out );
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user