| 166 | } |
| 167 | |
| 168 | void |
| 169 | l_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 | |
| 196 | DISABLE_WARNING_UNREACHABLE_CODE |
| 197 |
no test coverage detected