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

Function isEnv

third-party/lua-5.4.6/src/ldebug.c:558–569  ·  view source on GitHub ↗

** Check whether table being indexed by instruction 'i' is the ** environment '_ENV'. If the table is an upvalue, get its name; ** otherwise, find some "name" for the table and check whether ** that name is the name of a local variable (and not, for instance, ** a string). Then check that, if there is a name, it is '_ENV'. */

Source from the content-addressed store, hash-verified

556** a string). Then check that, if there is a name, it is '_ENV'.
557*/
558static const char *isEnv (const Proto *p, int pc, Instruction i, int isup) {
559 int t = GETARG_B(i); /* table index */
560 const char *name; /* name of indexed variable */
561 if (isup) /* is 't' an upvalue? */
562 name = upvalname(p, t);
563 else { /* 't' is a register */
564 const char *what = basicgetobjname(p, &pc, t, &name);
565 if (what != strlocal && what != strupval)
566 name = NULL; /* cannot be the variable _ENV */
567 }
568 return (name && strcmp(name, LUA_ENV) == 0) ? "global" : "field";
569}
570
571
572/*

Callers 1

getobjnameFunction · 0.70

Calls 2

upvalnameFunction · 0.70
basicgetobjnameFunction · 0.70

Tested by

no test coverage detected