mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
Clearer distinction between types and tags
LUA_T* represents only types; tags (types + Variants) are represented by LUA_V* constants.
This commit is contained in:
parent
69c7139ff8
commit
46c3587a6f
22 changed files with 231 additions and 213 deletions
18
ldump.c
18
ldump.c
|
|
@ -111,21 +111,21 @@ static void DumpConstants (const Proto *f, DumpState *D) {
|
|||
DumpInt(n, D);
|
||||
for (i = 0; i < n; i++) {
|
||||
const TValue *o = &f->k[i];
|
||||
DumpByte(ttypetag(o), D);
|
||||
switch (ttypetag(o)) {
|
||||
case LUA_TNIL: case LUA_TFALSE: case LUA_TTRUE:
|
||||
break;
|
||||
case LUA_TNUMFLT:
|
||||
int tt = ttypetag(o);
|
||||
DumpByte(tt, D);
|
||||
switch (tt) {
|
||||
case LUA_VNUMFLT:
|
||||
DumpNumber(fltvalue(o), D);
|
||||
break;
|
||||
case LUA_TNUMINT:
|
||||
case LUA_VNUMINT:
|
||||
DumpInteger(ivalue(o), D);
|
||||
break;
|
||||
case LUA_TSHRSTR:
|
||||
case LUA_TLNGSTR:
|
||||
case LUA_VSHRSTR:
|
||||
case LUA_VLNGSTR:
|
||||
DumpString(tsvalue(o), D);
|
||||
break;
|
||||
default: lua_assert(0);
|
||||
default:
|
||||
lua_assert(tt == LUA_VNIL || tt == LUA_VFALSE || tt == LUA_VTRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue