MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / lua_load_with_check

Function lua_load_with_check

src/Chain/libraries/glua/lapi.cpp:1017–1038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1015}
1016
1017LUA_API int lua_load_with_check(lua_State *L, lua_Reader reader, void *data,
1018 const char *chunkname, const char *mode, const int check_type) {
1019 ZIO z;
1020 int status;
1021 lua_lock(L);
1022 if (!chunkname) chunkname = "?";
1023 luaZ_init(L, &z, reader, data);
1024 status = luaD_protectedparser(L, &z, chunkname, mode);
1025 if (status == LUA_OK) { /* no errors? */
1026 LClosure *f = clLvalue(L->top - 1); /* get newly created function */
1027 if (f->nupvalues >= 1) { /* does it have an upvalue? */
1028 /* get global table from registry */
1029 Table *reg = hvalue(&G(L)->l_registry);
1030 const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
1031 /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */
1032 setobj(L, f->upvals[0]->v, gt);
1033 luaC_upvalbarrier(L, f->upvals[0]);
1034 }
1035 }
1036 lua_unlock(L);
1037 return status;
1038}
1039
1040static int lua_common_compile(lua_State *L, lua_Reader reader, void *dt,
1041 const char *chunkname, const char *mode, lua_Writer writer, void *dest)

Callers 1

Calls 3

luaZ_initFunction · 0.85
luaD_protectedparserFunction · 0.85
luaH_getintFunction · 0.85

Tested by

no test coverage detected