MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / lua_load

Function lua_load

lib/lua/src/lapi.c:1087–1107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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