Expose time diff functions

This commit is contained in:
Rochet2
2014-12-11 11:31:16 +02:00
parent a068a33bed
commit e683f48fbb
2 changed files with 27 additions and 0 deletions

View File

@@ -2254,5 +2254,30 @@ namespace LuaGlobalFunctions
Eluna::Push(L, Player::IsBagPos((bag << 8) + slot));
return 1;
}
/**
* Returns current time in ms
*
* @return uint32 currTime
*/
int GetCurrTime(Eluna* E)
{
Eluna::Push(E->L, ElunaUtil::GetCurrTime());
return 1;
}
/**
* Returns difference from a [Global:GetCurrTime] time to now
*
* @param uint32 oldTime
* @return uint32 timeDiff
*/
int GetTimeDiff(Eluna* E)
{
uint32 oldtimems = Eluna::CHECKVAL<uint32>(E->L, 1);
Eluna::Push(E->L, ElunaUtil::GetTimeDiff(oldtimems));
return 1;
}
}
#endif

View File

@@ -85,6 +85,8 @@ ElunaGlobal::ElunaRegister GlobalMethods[] =
{ "bit_and", &LuaGlobalFunctions::bit_and },
{ "GetItemLink", &LuaGlobalFunctions::GetItemLink },
{ "GetMapById", &LuaGlobalFunctions::GetMapById },
{ "GetCurrTime", &LuaGlobalFunctions::GetCurrTime },
{ "GetTimeDiff", &LuaGlobalFunctions::GetTimeDiff },
// Boolean
{ "IsInventoryPos", &LuaGlobalFunctions::IsInventoryPos },