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

Function nhl_pcall_handle

src/nhlua.c:2154–2178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2152}
2153
2154int
2155nhl_pcall_handle(lua_State *L, int nargs, int nresults, const char *name,
2156 NHL_pcall_action npa)
2157{
2158 int rv = nhl_pcall(L, nargs, nresults, name);
2159 if (rv) {
2160 nhl_user_data *nud;
2161 (void) lua_getallocf(L, (void **) &nud);
2162 /* XXX can we get a lua stack trace as well? */
2163 switch (npa) {
2164 case NHLpa_panic:
2165 panic("Lua error %d:%s %s", nud->sid,
2166 nud->name ? nud->name : "(unknown)", lua_tostring(L, -1));
2167 /*NOTREACHED*/
2168 break;
2169 case NHLpa_impossible:
2170 impossible("Lua error: %d:%s %s", nud->sid,
2171 nud->name ? nud->name : "(unknown)",
2172 lua_tostring(L, -1));
2173 /* Drop the error. If the caller cares, use nhl_pcall(). */
2174 lua_pop(L, 1);
2175 }
2176 }
2177 return rv;
2178}
2179
2180/* XXX impossible() should be swappable with pline/nothing/panic via flag */
2181/* read lua code/data from a dlb module or an external file

Callers 15

allmain.cFile · 0.85
goto_levelFunction · 0.85
l_nhcore_callFunction · 0.85
get_table_str_optFunction · 0.85
nhl_variableFunction · 0.85
get_nh_lua_variablesFunction · 0.85
restore_luadataFunction · 0.85
nhl_callbackFunction · 0.85
nhl_loadluaFunction · 0.85
l_selection_iterateFunction · 0.85
makeroomsFunction · 0.85

Calls 3

nhl_pcallFunction · 0.85
impossibleFunction · 0.70
panicFunction · 0.50

Tested by

no test coverage detected