public void FakeG() { this.fakedLocals = new List <FakeVar>(); this.fakedUpvalues = new List <FakeVar>(); if (!this.CanFakeEnvironment) { return; } string varName; BBLua.lua_getinfo(ls.L, "f", this.funcInfo); // 'f': pushes func onto stack for (int i = 1; ; i++) { varName = BBLua.lua_getupvalue(ls.L, -1, i); if (varName == null) { break; } TryFakeVar(varName, i, this.fakedUpvalues); } BBLua.lua_settop(ls.L, -2); //remove func from stack for (int i = 1; ; i++) { varName = BBLua.lua_getlocal(ls.L, this.funcInfo, i); if (varName == null) { break; } if (varName.Length > 0 && varName[0] != '(') { TryFakeVar(varName, i, this.fakedLocals); } else { BBLua.lua_settop(ls.L, -2); //remove value } } }