MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / isEnv

Function isEnv

third-party/lua-5.5.0/src/ldebug.c:550–563  ·  view source on GitHub ↗

** Check whether table being indexed by instruction 'i' is the ** environment '_ENV' */

Source from the content-addressed store, hash-verified

548** environment '_ENV'
549*/
550static const char *isEnv (const Proto *p, int pc, Instruction i, int isup) {
551 int t = GETARG_B(i); /* table index */
552 const char *name; /* name of indexed variable */
553 if (isup) /* is 't' an upvalue? */
554 name = upvalname(p, t);
555 else { /* 't' is a register */
556 const char *what = basicgetobjname(p, &pc, t, &name);
557 /* 'name' must be the name of a local variable (at the current
558 level or an upvalue) */
559 if (what != strlocal && what != strupval)
560 name = NULL; /* cannot be the variable _ENV */
561 }
562 return (name && strcmp(name, LUA_ENV) == 0) ? "global" : "field";
563}
564
565
566/*

Callers 1

getobjnameFunction · 0.70

Calls 2

upvalnameFunction · 0.70
basicgetobjnameFunction · 0.70

Tested by

no test coverage detected