MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / LoadConstants

Function LoadConstants

Source/Misc/lua/src/lua.c:10003–10038  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10001static Proto* LoadFunction(LoadState* S, TString* p);
10002
10003static void LoadConstants(LoadState* S, Proto* f)
10004{
10005int i,n;
10006n=LoadInt(S);
10007f->k=luaM_newvector(S->L,n,TValue);
10008f->sizek=n;
10009for (i=0; i<n; i++) setnilvalue(&f->k[i]);
10010for (i=0; i<n; i++)
10011{
10012TValue* o=&f->k[i];
10013int t=LoadChar(S);
10014switch (t)
10015{
10016case LUA_TNIL:
10017 setnilvalue(o);
10018 break;
10019case LUA_TBOOLEAN:
10020 setbvalue(o,LoadChar(S)!=0);
10021 break;
10022case LUA_TNUMBER:
10023 setnvalue(o,LoadNumber(S));
10024 break;
10025case LUA_TSTRING:
10026 setsvalue2n(S->L,o,LoadString(S));
10027 break;
10028default:
10029 error(S,"bad constant");
10030 break;
10031}
10032}
10033n=LoadInt(S);
10034f->p=luaM_newvector(S->L,n,Proto*);
10035f->sizep=n;
10036for (i=0; i<n; i++) f->p[i]=NULL;
10037for (i=0; i<n; i++) f->p[i]=LoadFunction(S,f->source);
10038}
10039
10040static void LoadDebug(LoadState* S, Proto* f)
10041{

Callers 1

LoadFunctionFunction · 0.85

Calls 6

LoadIntFunction · 0.85
LoadCharFunction · 0.85
LoadNumberFunction · 0.85
LoadStringFunction · 0.85
LoadFunctionFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected