CvLuaGame::lRand(lua_State *)
- Defined in
- Lua/CvLuaGame.cpp, line 1601
- Class
- CvLuaGame
- Hook name
CivHooks::CvLuaGame_lRand
Hooks
static bool BeforeCvLuaGame_lRand(lua_State* L, int& result);static void AfterCvLuaGame_lRand(lua_State* L, int& result);static int ReplaceCvLuaGame_lRand(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaGame_lRand>(host, &BeforeCvLuaGame_lRand);CivRegisterAfter<CivHooks::CvLuaGame_lRand>(host, &AfterCvLuaGame_lRand);CivRegisterReplace<CivHooks::CvLuaGame_lRand>(host, &ReplaceCvLuaGame_lRand);
Code
1600//int Rand(max_num, log);1601int CvLuaGame::lRand(lua_State* L)1602{1603 const int max_num = luaL_checkinteger(L, 1);1604 const char* strLog = luaL_checkstring(L, 2);1605#if defined(MOD_BUGFIX_RANDOM)1606 const int rand_val = GetInstance()->getJonRandNum(max_num, strLog);1607#else1608 const int rand_val = GetInstance()->getJonRand().get(max_num, strLog);1609#endif16101611 lua_pushinteger(L, rand_val);1612 return 1;1613}
Calls
- CvGame::getJonRandNum(int, const char *)
- CvLuaGame::GetInstance(lua_State *, int)
lua_pushintegerluaL_checkintegerluaL_checklstring