| 1079 | static int DFHACK_RANDOM_TOKEN = 0; |
| 1080 | |
| 1081 | static 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 | |
| 1093 | static int dfhack_random_init(lua_State *L) |
| 1094 | { |
no test coverage detected