MCPcopy Create free account
hub / github.com/Cubitect/cubiomes-viewer / lua_load

Function lua_load

lua/src/lapi.c:1090–1110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1088
1089
1090LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data,
1091 const char *chunkname, const char *mode) {
1092 ZIO z;
1093 int status;
1094 lua_lock(L);
1095 if (!chunkname) chunkname = "?";
1096 luaZ_init(L, &z, reader, data);
1097 status = luaD_protectedparser(L, &z, chunkname, mode);
1098 if (status == LUA_OK) { /* no errors? */
1099 LClosure *f = clLvalue(s2v(L->top - 1)); /* get newly created function */
1100 if (f->nupvalues >= 1) { /* does it have an upvalue? */
1101 /* get global table from registry */
1102 const TValue *gt = getGtable(L);
1103 /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */
1104 setobj(L, f->upvals[0]->v, gt);
1105 luaC_barrier(L, f->upvals[0], gt);
1106 }
1107 }
1108 lua_unlock(L);
1109 return status;
1110}
1111
1112
1113LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) {

Callers 4

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

Calls 2

luaZ_initFunction · 0.85
luaD_protectedparserFunction · 0.85

Tested by

no test coverage detected