Added CclSyncRand
This commit is contained in:
parent
b1bff0a379
commit
6fc9745be8
1 changed files with 17 additions and 1 deletions
|
@ -937,6 +937,20 @@ local int CclGetStratagusLibraryPath(lua_State* l)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
** Get a value from the Stratagus syncronized random number generator.
|
||||
*/
|
||||
local int CclSyncRand(lua_State* l)
|
||||
{
|
||||
if (lua_gettop(l) != 1) {
|
||||
lua_pushstring(l, "incorrect argument");
|
||||
lua_error(l);
|
||||
}
|
||||
|
||||
lua_pushnumber(l, SyncRand() % (int)LuaToNumber(l, -1));
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*............................................................................
|
||||
.. Tables
|
||||
............................................................................*/
|
||||
|
@ -1175,7 +1189,7 @@ global void ScriptProxyTypeInitBlock(ScriptProxyType* type)
|
|||
}
|
||||
|
||||
/**
|
||||
** Get a value from the Stratagus syncronized random number generator.
|
||||
** Get a value from the Stratagus syncronized random number generator.
|
||||
*/
|
||||
local int ScriptSyncRand(lua_State* l)
|
||||
{
|
||||
|
@ -1390,6 +1404,8 @@ global void InitCcl(void)
|
|||
lua_register(Lua, "GetStratagusHomePath", CclGetStratagusHomePath);
|
||||
lua_register(Lua, "GetStratagusLibraryPath",
|
||||
CclGetStratagusLibraryPath);
|
||||
|
||||
lua_register(Lua, "SyncRand", CclSyncRand);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue