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

Function lua_load

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

Source from the content-addressed store, hash-verified

992
993
994LUA_API int lua_load(lua_State *L, lua_Reader reader, void *data,
995 const char *chunkname, const char *mode) {
996 ZIO z;
997 int status;
998 lua_lock(L);
999 if (!chunkname) chunkname = "?";
1000 luaZ_init(L, &z, reader, data);
1001 status = luaD_protectedparser(L, &z, chunkname, mode);
1002 if (status == LUA_OK) { /* no errors? */
1003 LClosure *f = clLvalue(L->top - 1); /* get newly created function */
1004 if (f->nupvalues >= 1) { /* does it have an upvalue? */
1005 /* get global table from registry */
1006 Table *reg = hvalue(&G(L)->l_registry);
1007 const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS);
1008 /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */
1009 setobj(L, f->upvals[0]->v, gt);
1010 luaC_upvalbarrier(L, f->upvals[0]);
1011 }
1012 }
1013 lua_unlock(L);
1014 return status;
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) {

Callers 6

combineFunction · 0.85
luaL_loadfilexFunction · 0.85
lua_compilefile_preloadFunction · 0.85
luaL_loadbufferxFunction · 0.85
luaB_loadFunction · 0.85
combineFunction · 0.85

Calls 3

luaZ_initFunction · 0.85
luaD_protectedparserFunction · 0.85
luaH_getintFunction · 0.85

Tested by

no test coverage detected