int terra_load(lua_State *L,lua_Reader reader, void *data, const char *chunkname) { int st = lua_gettop(L); terra_State * T = getterra(L); Zio zio; luaZ_init(T,&zio,reader,data); int r = luaY_parser(T,&zio,chunkname,zgetc(&zio)); assert(lua_gettop(L) == st + 1); return r; }
LUA_API int lua_wload (lua_State *L, lua_Reader reader, void *data, const char *chunkname) { ZIO z; int status; lua_lock(L); if (!chunkname) chunkname = "?"; luaZ_init(L, &z, reader, data); z.isWide = 1; status = luaD_protectedparser(L, &z, chunkname); lua_unlock(L); return status; }
void pluto_unpersist(lua_State *L, lua_Chunkreader reader, void *ud) { /* We use the graciously provided ZIO (what the heck does the Z stand * for?) library so that we don't have to deal with the reader directly. * Letting the reader function decide how much data to return can be * very unpleasant. */ UnpersistInfo upi; upi.L = L; #ifdef PLUTO_DEBUG upi.level = 0; #endif luaZ_init(&upi.zio, reader, ud, ""); /* perms */ lua_newtable(L); /* perms reftbl */ unpersist(&upi); /* perms reftbl rootobj */ lua_replace(L, 2); /* perms rootobj */ }