MCPcopy Index your code
hub / github.com/NetHack/NetHack / l_nhcore_call

Function l_nhcore_call

src/nhlua.c:168–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168void
169l_nhcore_call(int callidx)
170{
171 int ltyp;
172
173 if (callidx < 0 || callidx >= NUM_NHCORE_CALLS || !gl.luacore
174 || !nhcore_call_available[callidx])
175 return;
176
177 lua_getglobal(gl.luacore, "nhcore");
178 if (!lua_istable(gl.luacore, -1)) {
179 /*impossible("nhcore is not a lua table");*/
180 nhl_done(gl.luacore);
181 gl.luacore = 0;
182 return;
183 }
184
185 lua_getfield(gl.luacore, -1, nhcore_call_names[callidx]);
186 ltyp = lua_type(gl.luacore, -1);
187 if (ltyp == LUA_TFUNCTION) {
188 nhl_pcall_handle(gl.luacore, 0, 1, "l_nhcore_call", NHLpa_panic);
189 } else {
190 /*impossible("nhcore.%s is not a lua function",
191 nhcore_call_names[callidx]);*/
192 nhcore_call_available[callidx] = FALSE;
193 }
194}
195
196DISABLE_WARNING_UNREACHABLE_CODE
197

Callers 5

nh_terminateFunction · 0.85
allmain.cFile · 0.85
welcomeFunction · 0.85
tutorialFunction · 0.85
handle_tipFunction · 0.85

Calls 2

nhl_doneFunction · 0.85
nhl_pcall_handleFunction · 0.85

Tested by

no test coverage detected