MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / getposition

Function getposition

other_src/lua/src/lpeg.cpp:233–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231
232
233static int getposition (lua_State *L, int t, int i) {
234 int res;
235 lua_getfenv(L, -1);
236 lua_rawgeti(L, -1, i); /* get key from pattern's environment */
237 lua_gettable(L, t); /* get position from positions table */
238 res = lua_tointeger(L, -1);
239 if (res == 0) { /* key has no registered position? */
240 lua_rawgeti(L, -2, i); /* get key again */
241 return luaL_error(L, "%s is not defined in given grammar", val2str(L, -1));
242 }
243 lua_pop(L, 2); /* remove environment and position */
244 return res;
245}
246
247
248/*

Callers 2

verifyFunction · 0.85
fix_lFunction · 0.85

Calls 6

lua_tointegerFunction · 0.85
val2strFunction · 0.85
lua_getfenvFunction · 0.70
lua_rawgetiFunction · 0.70
lua_gettableFunction · 0.70
luaL_errorFunction · 0.70

Tested by

no test coverage detected