Bazaar developer reference

CvLuaMap::lRand(lua_State *)

Defined in
Lua/CvLuaMap.cpp, line 342
Class
CvLuaMap
Hook name
CivHooks::CvLuaMap_lRand

Hooks

static bool BeforeCvLuaMap_lRand(lua_State* L, int& result);static void AfterCvLuaMap_lRand(lua_State* L, int& result);static int ReplaceCvLuaMap_lRand(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaMap_lRand>(host, &BeforeCvLuaMap_lRand);CivRegisterAfter<CivHooks::CvLuaMap_lRand>(host, &AfterCvLuaMap_lRand);CivRegisterReplace<CivHooks::CvLuaMap_lRand>(host, &ReplaceCvLuaMap_lRand);

Code

342int CvLuaMap::lRand(lua_State* L)343{344	const int max_num = luaL_checkinteger(L, 1);345	const char* strLog = luaL_checkstring(L, 2);346	const int rand_val = GC.getGame().getMapRandNum(max_num, strLog);347348	lua_pushinteger(L, rand_val);349	return 1;350}

Calls

Called by