MCPcopy Create free account
hub / github.com/DFHack/dfhack / check_random_native

Function check_random_native

library/LuaApi.cpp:1081–1091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1079static int DFHACK_RANDOM_TOKEN = 0;
1080
1081static MersenneRNG *check_random_native(lua_State *L, int index)
1082{
1083 lua_rawgetp(L, LUA_REGISTRYINDEX, &DFHACK_RANDOM_TOKEN);
1084
1085 if (!lua_getmetatable(L, index) || !lua_rawequal(L, -1, -2))
1086 luaL_argerror(L, index, "not a random generator object");
1087
1088 lua_pop(L, 2);
1089
1090 return (MersenneRNG*)lua_touserdata(L, index);
1091}
1092
1093static int dfhack_random_init(lua_State *L)
1094{

Callers 8

dfhack_random_initFunction · 0.85
dfhack_random_randomFunction · 0.85
dfhack_random_drandomFunction · 0.85
dfhack_random_drandom0Function · 0.85
dfhack_random_drandom1Function · 0.85
dfhack_random_unitrandomFunction · 0.85
dfhack_random_unitvectorFunction · 0.85
dfhack_random_perlinFunction · 0.85

Calls 5

lua_rawgetpFunction · 0.85
lua_getmetatableFunction · 0.85
lua_rawequalFunction · 0.85
luaL_argerrorFunction · 0.85
lua_touserdataFunction · 0.85

Tested by

no test coverage detected