1998-01-14 23:49:01 +08:00
|
|
|
/*
|
2018-08-24 01:26:12 +08:00
|
|
|
** $Id: lundump.c $
|
2005-11-16 19:55:07 +08:00
|
|
|
** load precompiled Lua chunks
|
1998-01-14 23:49:01 +08:00
|
|
|
** See Copyright Notice in lua.h
|
|
|
|
*/
|
|
|
|
|
2002-12-05 01:38:31 +08:00
|
|
|
#define lundump_c
|
2004-05-01 04:13:38 +08:00
|
|
|
#define LUA_CORE
|
2002-12-05 01:38:31 +08:00
|
|
|
|
2014-11-03 03:19:04 +08:00
|
|
|
#include "lprefix.h"
|
|
|
|
|
|
|
|
|
2019-03-20 02:31:08 +08:00
|
|
|
#include <limits.h>
|
2014-11-03 03:19:04 +08:00
|
|
|
#include <string.h>
|
|
|
|
|
2001-03-26 22:31:49 +08:00
|
|
|
#include "lua.h"
|
|
|
|
|
2001-07-06 04:29:15 +08:00
|
|
|
#include "ldebug.h"
|
2003-08-28 05:01:44 +08:00
|
|
|
#include "ldo.h"
|
1998-01-14 23:49:01 +08:00
|
|
|
#include "lfunc.h"
|
|
|
|
#include "lmem.h"
|
2005-11-16 19:55:07 +08:00
|
|
|
#include "lobject.h"
|
1998-01-14 23:49:01 +08:00
|
|
|
#include "lstring.h"
|
2022-12-16 03:44:22 +08:00
|
|
|
#include "ltable.h"
|
1998-01-14 23:49:01 +08:00
|
|
|
#include "lundump.h"
|
2002-06-06 01:26:23 +08:00
|
|
|
#include "lzio.h"
|
1998-01-14 23:49:01 +08:00
|
|
|
|
|
|
|
|
2011-05-17 20:42:43 +08:00
|
|
|
#if !defined(luai_verifycode)
|
2020-06-18 22:07:27 +08:00
|
|
|
#define luai_verifycode(L,f) /* empty */
|
2011-05-17 20:42:43 +08:00
|
|
|
#endif
|
|
|
|
|
2014-03-11 01:56:32 +08:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
lua_State *L;
|
|
|
|
ZIO *Z;
|
|
|
|
const char *name;
|
2022-12-16 03:44:22 +08:00
|
|
|
Table *h; /* list for string reuse */
|
|
|
|
lua_Integer nstr; /* number of strings in the list */
|
2014-03-11 01:56:32 +08:00
|
|
|
} LoadState;
|
|
|
|
|
|
|
|
|
2018-06-02 00:45:58 +08:00
|
|
|
static l_noret error (LoadState *S, const char *why) {
|
2019-03-20 02:31:08 +08:00
|
|
|
luaO_pushfstring(S->L, "%s: bad binary format (%s)", S->name, why);
|
2014-03-11 01:56:32 +08:00
|
|
|
luaD_throw(S->L, LUA_ERRSYNTAX);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-12 02:56:27 +08:00
|
|
|
/*
|
2020-02-28 02:17:44 +08:00
|
|
|
** All high-level loads go through loadVector; you can change it to
|
2014-03-27 23:58:05 +08:00
|
|
|
** adapt to the endianness of the input
|
2014-03-12 02:56:27 +08:00
|
|
|
*/
|
2020-02-28 02:17:44 +08:00
|
|
|
#define loadVector(S,b,n) loadBlock(S,b,(n)*sizeof((b)[0]))
|
2014-03-12 02:56:27 +08:00
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static void loadBlock (LoadState *S, void *b, size_t size) {
|
2014-03-11 01:56:32 +08:00
|
|
|
if (luaZ_read(S->Z, b, size) != 0)
|
2019-03-20 02:31:08 +08:00
|
|
|
error(S, "truncated chunk");
|
2014-03-11 01:56:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
#define loadVar(S,x) loadVector(S,&x,1)
|
2014-03-12 02:56:27 +08:00
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static lu_byte loadByte (LoadState *S) {
|
2017-06-27 22:21:12 +08:00
|
|
|
int b = zgetc(S->Z);
|
|
|
|
if (b == EOZ)
|
2019-03-20 02:31:08 +08:00
|
|
|
error(S, "truncated chunk");
|
2017-06-27 22:21:12 +08:00
|
|
|
return cast_byte(b);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static size_t loadUnsigned (LoadState *S, size_t limit) {
|
2017-06-27 22:21:12 +08:00
|
|
|
size_t x = 0;
|
|
|
|
int b;
|
2019-03-20 02:31:08 +08:00
|
|
|
limit >>= 7;
|
2017-06-27 22:21:12 +08:00
|
|
|
do {
|
2020-02-28 02:17:44 +08:00
|
|
|
b = loadByte(S);
|
2019-03-20 02:31:08 +08:00
|
|
|
if (x >= limit)
|
|
|
|
error(S, "integer overflow");
|
2017-06-27 22:21:12 +08:00
|
|
|
x = (x << 7) | (b & 0x7f);
|
|
|
|
} while ((b & 0x80) == 0);
|
2014-03-11 01:56:32 +08:00
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static size_t loadSize (LoadState *S) {
|
|
|
|
return loadUnsigned(S, ~(size_t)0);
|
2019-03-20 02:31:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static int loadInt (LoadState *S) {
|
|
|
|
return cast_int(loadUnsigned(S, INT_MAX));
|
2014-03-11 01:56:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static lua_Number loadNumber (LoadState *S) {
|
2014-03-11 01:56:32 +08:00
|
|
|
lua_Number x;
|
2020-02-28 02:17:44 +08:00
|
|
|
loadVar(S, x);
|
2014-03-11 01:56:32 +08:00
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static lua_Integer loadInteger (LoadState *S) {
|
2014-03-11 01:56:32 +08:00
|
|
|
lua_Integer x;
|
2020-02-28 02:17:44 +08:00
|
|
|
loadVar(S, x);
|
2014-03-11 01:56:32 +08:00
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-06-02 00:45:58 +08:00
|
|
|
/*
|
2020-06-16 20:54:20 +08:00
|
|
|
** Load a nullable string into prototype 'p'.
|
2018-06-02 00:45:58 +08:00
|
|
|
*/
|
2020-06-16 20:54:20 +08:00
|
|
|
static TString *loadStringN (LoadState *S, Proto *p) {
|
|
|
|
lua_State *L = S->L;
|
|
|
|
TString *ts;
|
2022-12-16 03:44:22 +08:00
|
|
|
TValue sv;
|
2020-02-28 02:17:44 +08:00
|
|
|
size_t size = loadSize(S);
|
2020-06-16 20:54:20 +08:00
|
|
|
if (size == 0) /* no string? */
|
2014-03-11 01:56:32 +08:00
|
|
|
return NULL;
|
2022-12-16 03:44:22 +08:00
|
|
|
else if (size == 1) { /* previously saved string? */
|
|
|
|
int idx = loadInt(S); /* get its index */
|
|
|
|
const TValue *stv = luaH_getint(S->h, idx);
|
|
|
|
return tsvalue(stv);
|
|
|
|
}
|
|
|
|
else if (size -= 2, size <= LUAI_MAXSHORTLEN) { /* short string? */
|
2015-09-08 23:41:05 +08:00
|
|
|
char buff[LUAI_MAXSHORTLEN];
|
2020-06-16 20:54:20 +08:00
|
|
|
loadVector(S, buff, size); /* load string into buffer */
|
|
|
|
ts = luaS_newlstr(L, buff, size); /* create string */
|
2015-09-08 23:41:05 +08:00
|
|
|
}
|
|
|
|
else { /* long string */
|
2020-06-16 20:54:20 +08:00
|
|
|
ts = luaS_createlngstrobj(L, size); /* create string */
|
2022-10-29 23:06:37 +08:00
|
|
|
setsvalue2s(L, L->top.p, ts); /* anchor it ('loadVector' can GC) */
|
2020-08-19 01:42:11 +08:00
|
|
|
luaD_inctop(L);
|
2020-02-28 02:17:44 +08:00
|
|
|
loadVector(S, getstr(ts), size); /* load directly in final place */
|
2022-10-29 23:06:37 +08:00
|
|
|
L->top.p--; /* pop string */
|
2001-07-06 04:29:15 +08:00
|
|
|
}
|
2020-06-16 20:54:20 +08:00
|
|
|
luaC_objbarrier(L, p, ts);
|
2022-12-16 03:44:22 +08:00
|
|
|
S->nstr++; /* add string to list of saved strings */
|
|
|
|
setsvalue(L, &sv, ts);
|
|
|
|
luaH_setint(L, S->h, S->nstr, &sv);
|
|
|
|
luaC_objbarrierback(L, obj2gco(S->h), ts);
|
2020-06-16 20:54:20 +08:00
|
|
|
return ts;
|
2014-02-28 00:56:20 +08:00
|
|
|
}
|
|
|
|
|
2014-03-11 01:56:32 +08:00
|
|
|
|
2018-06-02 00:45:58 +08:00
|
|
|
/*
|
2020-06-16 20:54:20 +08:00
|
|
|
** Load a non-nullable string into prototype 'p'.
|
2018-06-02 00:45:58 +08:00
|
|
|
*/
|
2020-06-16 20:54:20 +08:00
|
|
|
static TString *loadString (LoadState *S, Proto *p) {
|
|
|
|
TString *st = loadStringN(S, p);
|
2018-06-02 00:45:58 +08:00
|
|
|
if (st == NULL)
|
|
|
|
error(S, "bad format for constant string");
|
|
|
|
return st;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static void loadCode (LoadState *S, Proto *f) {
|
|
|
|
int n = loadInt(S);
|
2017-12-08 02:59:52 +08:00
|
|
|
f->code = luaM_newvectorchecked(S->L, n, Instruction);
|
2014-03-11 01:56:32 +08:00
|
|
|
f->sizecode = n;
|
2020-02-28 02:17:44 +08:00
|
|
|
loadVector(S, f->code, n);
|
2014-03-11 01:56:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static void loadFunction(LoadState *S, Proto *f, TString *psource);
|
2014-03-11 01:56:32 +08:00
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static void loadConstants (LoadState *S, Proto *f) {
|
2014-06-19 02:35:43 +08:00
|
|
|
int i;
|
2020-02-28 02:17:44 +08:00
|
|
|
int n = loadInt(S);
|
2017-12-08 02:59:52 +08:00
|
|
|
f->k = luaM_newvectorchecked(S->L, n, TValue);
|
2014-03-11 01:56:32 +08:00
|
|
|
f->sizek = n;
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
setnilvalue(&f->k[i]);
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
TValue *o = &f->k[i];
|
2020-02-28 02:17:44 +08:00
|
|
|
int t = loadByte(S);
|
2014-03-11 01:56:32 +08:00
|
|
|
switch (t) {
|
2020-01-31 22:09:53 +08:00
|
|
|
case LUA_VNIL:
|
2017-11-28 19:19:07 +08:00
|
|
|
setnilvalue(o);
|
|
|
|
break;
|
2020-01-31 22:09:53 +08:00
|
|
|
case LUA_VFALSE:
|
2020-01-06 22:38:31 +08:00
|
|
|
setbfvalue(o);
|
|
|
|
break;
|
2020-01-31 22:09:53 +08:00
|
|
|
case LUA_VTRUE:
|
2020-01-06 22:38:31 +08:00
|
|
|
setbtvalue(o);
|
2017-11-28 19:19:07 +08:00
|
|
|
break;
|
2020-01-31 22:09:53 +08:00
|
|
|
case LUA_VNUMFLT:
|
2020-02-28 02:17:44 +08:00
|
|
|
setfltvalue(o, loadNumber(S));
|
2017-11-28 19:19:07 +08:00
|
|
|
break;
|
2020-01-31 22:09:53 +08:00
|
|
|
case LUA_VNUMINT:
|
2020-02-28 02:17:44 +08:00
|
|
|
setivalue(o, loadInteger(S));
|
2017-11-28 19:19:07 +08:00
|
|
|
break;
|
2020-01-31 22:09:53 +08:00
|
|
|
case LUA_VSHRSTR:
|
|
|
|
case LUA_VLNGSTR:
|
2020-06-16 20:54:20 +08:00
|
|
|
setsvalue2n(S->L, o, loadString(S, f));
|
2017-11-28 19:19:07 +08:00
|
|
|
break;
|
|
|
|
default: lua_assert(0);
|
2014-03-11 01:56:32 +08:00
|
|
|
}
|
|
|
|
}
|
2014-06-19 02:35:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static void loadProtos (LoadState *S, Proto *f) {
|
2014-06-19 02:35:43 +08:00
|
|
|
int i;
|
2020-02-28 02:17:44 +08:00
|
|
|
int n = loadInt(S);
|
2017-12-08 02:59:52 +08:00
|
|
|
f->p = luaM_newvectorchecked(S->L, n, Proto *);
|
2014-03-11 01:56:32 +08:00
|
|
|
f->sizep = n;
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
f->p[i] = NULL;
|
|
|
|
for (i = 0; i < n; i++) {
|
|
|
|
f->p[i] = luaF_newproto(S->L);
|
2020-06-16 20:54:20 +08:00
|
|
|
luaC_objbarrier(S->L, f, f->p[i]);
|
2020-02-28 02:17:44 +08:00
|
|
|
loadFunction(S, f->p[i], f->source);
|
2014-03-11 01:56:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-01 02:36:26 +08:00
|
|
|
/*
|
|
|
|
** Load the upvalues for a function. The names must be filled first,
|
|
|
|
** because the filling of the other fields can raise read errors and
|
|
|
|
** the creation of the error message can call an emergency collection;
|
|
|
|
** in that case all prototypes must be consistent for the GC.
|
|
|
|
*/
|
2020-02-28 02:17:44 +08:00
|
|
|
static void loadUpvalues (LoadState *S, Proto *f) {
|
2014-03-11 01:56:32 +08:00
|
|
|
int i, n;
|
2020-02-28 02:17:44 +08:00
|
|
|
n = loadInt(S);
|
2017-12-08 02:59:52 +08:00
|
|
|
f->upvalues = luaM_newvectorchecked(S->L, n, Upvaldesc);
|
2014-03-11 01:56:32 +08:00
|
|
|
f->sizeupvalues = n;
|
2020-07-01 02:36:26 +08:00
|
|
|
for (i = 0; i < n; i++) /* make array valid for GC */
|
2019-07-12 22:38:42 +08:00
|
|
|
f->upvalues[i].name = NULL;
|
2020-07-01 02:36:26 +08:00
|
|
|
for (i = 0; i < n; i++) { /* following calls can raise errors */
|
2020-02-28 02:17:44 +08:00
|
|
|
f->upvalues[i].instack = loadByte(S);
|
|
|
|
f->upvalues[i].idx = loadByte(S);
|
|
|
|
f->upvalues[i].kind = loadByte(S);
|
2014-03-11 01:56:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static void loadDebug (LoadState *S, Proto *f) {
|
2014-03-11 01:56:32 +08:00
|
|
|
int i, n;
|
2020-02-28 02:17:44 +08:00
|
|
|
n = loadInt(S);
|
2017-12-08 02:59:52 +08:00
|
|
|
f->lineinfo = luaM_newvectorchecked(S->L, n, ls_byte);
|
2014-03-11 01:56:32 +08:00
|
|
|
f->sizelineinfo = n;
|
2020-02-28 02:17:44 +08:00
|
|
|
loadVector(S, f->lineinfo, n);
|
|
|
|
n = loadInt(S);
|
2017-12-08 02:59:52 +08:00
|
|
|
f->abslineinfo = luaM_newvectorchecked(S->L, n, AbsLineInfo);
|
2017-06-27 19:35:31 +08:00
|
|
|
f->sizeabslineinfo = n;
|
|
|
|
for (i = 0; i < n; i++) {
|
2020-02-28 02:17:44 +08:00
|
|
|
f->abslineinfo[i].pc = loadInt(S);
|
|
|
|
f->abslineinfo[i].line = loadInt(S);
|
2017-06-27 19:35:31 +08:00
|
|
|
}
|
2020-02-28 02:17:44 +08:00
|
|
|
n = loadInt(S);
|
2017-12-08 02:59:52 +08:00
|
|
|
f->locvars = luaM_newvectorchecked(S->L, n, LocVar);
|
2014-03-11 01:56:32 +08:00
|
|
|
f->sizelocvars = n;
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
f->locvars[i].varname = NULL;
|
|
|
|
for (i = 0; i < n; i++) {
|
2020-06-16 20:54:20 +08:00
|
|
|
f->locvars[i].varname = loadStringN(S, f);
|
2020-02-28 02:17:44 +08:00
|
|
|
f->locvars[i].startpc = loadInt(S);
|
|
|
|
f->locvars[i].endpc = loadInt(S);
|
2014-03-11 01:56:32 +08:00
|
|
|
}
|
2020-02-28 02:17:44 +08:00
|
|
|
n = loadInt(S);
|
2014-03-11 01:56:32 +08:00
|
|
|
for (i = 0; i < n; i++)
|
2020-06-16 20:54:20 +08:00
|
|
|
f->upvalues[i].name = loadStringN(S, f);
|
2014-03-11 01:56:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-02-28 02:17:44 +08:00
|
|
|
static void loadFunction (LoadState *S, Proto *f, TString *psource) {
|
2020-06-16 20:54:20 +08:00
|
|
|
f->source = loadStringN(S, f);
|
2014-06-19 02:35:43 +08:00
|
|
|
if (f->source == NULL) /* no source in dump? */
|
|
|
|
f->source = psource; /* reuse parent's source */
|
2020-02-28 02:17:44 +08:00
|
|
|
f->linedefined = loadInt(S);
|
|
|
|
f->lastlinedefined = loadInt(S);
|
|
|
|
f->numparams = loadByte(S);
|
|
|
|
f->is_vararg = loadByte(S);
|
|
|
|
f->maxstacksize = loadByte(S);
|
|
|
|
loadCode(S, f);
|
|
|
|
loadConstants(S, f);
|
|
|
|
loadUpvalues(S, f);
|
|
|
|
loadProtos(S, f);
|
|
|
|
loadDebug(S, f);
|
2014-03-11 01:56:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-03-12 02:05:46 +08:00
|
|
|
static void checkliteral (LoadState *S, const char *s, const char *msg) {
|
|
|
|
char buff[sizeof(LUA_SIGNATURE) + sizeof(LUAC_DATA)]; /* larger than both */
|
2014-04-01 22:39:55 +08:00
|
|
|
size_t len = strlen(s);
|
2020-02-28 02:17:44 +08:00
|
|
|
loadVector(S, buff, len);
|
2014-03-12 02:05:46 +08:00
|
|
|
if (memcmp(s, buff, len) != 0)
|
2014-03-11 01:56:32 +08:00
|
|
|
error(S, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void fchecksize (LoadState *S, size_t size, const char *tname) {
|
2020-02-28 02:17:44 +08:00
|
|
|
if (loadByte(S) != size)
|
2019-03-20 02:31:08 +08:00
|
|
|
error(S, luaO_pushfstring(S->L, "%s size mismatch", tname));
|
2014-03-11 01:56:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-28 00:56:20 +08:00
|
|
|
#define checksize(S,t) fchecksize(S,sizeof(t),#t)
|
2011-05-17 20:42:43 +08:00
|
|
|
|
2014-03-11 01:56:32 +08:00
|
|
|
static void checkHeader (LoadState *S) {
|
2019-04-18 01:57:29 +08:00
|
|
|
/* skip 1st char (already read and checked) */
|
|
|
|
checkliteral(S, &LUA_SIGNATURE[1], "not a binary chunk");
|
2020-05-07 01:19:08 +08:00
|
|
|
if (loadByte(S) != LUAC_VERSION)
|
2019-03-20 02:31:08 +08:00
|
|
|
error(S, "version mismatch");
|
2020-02-28 02:17:44 +08:00
|
|
|
if (loadByte(S) != LUAC_FORMAT)
|
2019-03-20 02:31:08 +08:00
|
|
|
error(S, "format mismatch");
|
|
|
|
checkliteral(S, LUAC_DATA, "corrupted chunk");
|
2014-03-11 01:56:32 +08:00
|
|
|
checksize(S, Instruction);
|
|
|
|
checksize(S, lua_Integer);
|
|
|
|
checksize(S, lua_Number);
|
2020-02-28 02:17:44 +08:00
|
|
|
if (loadInteger(S) != LUAC_INT)
|
2019-03-20 02:31:08 +08:00
|
|
|
error(S, "integer format mismatch");
|
2020-02-28 02:17:44 +08:00
|
|
|
if (loadNumber(S) != LUAC_NUM)
|
2019-03-20 02:31:08 +08:00
|
|
|
error(S, "float format mismatch");
|
1998-01-14 23:49:01 +08:00
|
|
|
}
|
|
|
|
|
2014-03-11 01:56:32 +08:00
|
|
|
|
1998-01-14 23:49:01 +08:00
|
|
|
/*
|
2020-02-28 02:17:44 +08:00
|
|
|
** Load precompiled chunk.
|
1998-01-14 23:49:01 +08:00
|
|
|
*/
|
2015-09-08 23:41:05 +08:00
|
|
|
LClosure *luaU_undump(lua_State *L, ZIO *Z, const char *name) {
|
2014-03-11 01:56:32 +08:00
|
|
|
LoadState S;
|
2014-06-20 02:27:20 +08:00
|
|
|
LClosure *cl;
|
2014-03-11 01:56:32 +08:00
|
|
|
if (*name == '@' || *name == '=')
|
|
|
|
S.name = name + 1;
|
|
|
|
else if (*name == LUA_SIGNATURE[0])
|
|
|
|
S.name = "binary string";
|
|
|
|
else
|
|
|
|
S.name = name;
|
|
|
|
S.L = L;
|
|
|
|
S.Z = Z;
|
|
|
|
checkHeader(&S);
|
2020-02-28 02:17:44 +08:00
|
|
|
cl = luaF_newLclosure(L, loadByte(&S));
|
2022-10-29 23:06:37 +08:00
|
|
|
setclLvalue2s(L, L->top.p, cl);
|
2015-11-03 00:09:30 +08:00
|
|
|
luaD_inctop(L);
|
2022-12-16 03:44:22 +08:00
|
|
|
S.h = luaH_new(L); /* create list of saved strings */
|
|
|
|
S.nstr = 0;
|
|
|
|
sethvalue2s(L, L->top.p, S.h); /* anchor it */
|
|
|
|
luaD_inctop(L);
|
2014-06-20 02:27:20 +08:00
|
|
|
cl->p = luaF_newproto(L);
|
2020-06-16 20:54:20 +08:00
|
|
|
luaC_objbarrier(L, cl, cl->p);
|
2020-02-28 02:17:44 +08:00
|
|
|
loadFunction(&S, cl->p, NULL);
|
2014-06-20 02:27:20 +08:00
|
|
|
lua_assert(cl->nupvalues == cl->p->sizeupvalues);
|
2020-06-18 22:07:27 +08:00
|
|
|
luai_verifycode(L, cl->p);
|
2022-12-16 03:44:22 +08:00
|
|
|
L->top.p--; /* pop table */
|
2014-03-11 01:56:32 +08:00
|
|
|
return cl;
|
2000-09-05 02:53:41 +08:00
|
|
|
}
|
2014-03-11 01:56:32 +08:00
|
|
|
|