Overhaul of thread handling to support blocking functions other than wait
This commit is contained in:
@@ -120,8 +120,8 @@ static void tabify(Inspector &insp, int level) {
|
||||
|
||||
static void pprint_r(Inspector &insp, int level, LuaSlot root) {
|
||||
lua_checkstack(insp.L, 20);
|
||||
LuaVar idv, pairs, key, val;
|
||||
LuaStack LS(insp.L, idv, pairs, key, val);
|
||||
LuaVar idv, pairs, key, val, nextseq;
|
||||
LuaStack LS(insp.L, idv, pairs, key, val, nextseq);
|
||||
|
||||
// If it's anything but a table, use 'atomic_print'.
|
||||
if (!LS.istable(root)) {
|
||||
@@ -175,9 +175,9 @@ static void pprint_r(Inspector &insp, int level, LuaSlot root) {
|
||||
}
|
||||
|
||||
// State variables.
|
||||
int nextseq = 1;
|
||||
bool needcomma = false;
|
||||
bool multiline = false;
|
||||
LS.set(nextseq, 1);
|
||||
|
||||
// Open the brackets.
|
||||
(*insp.stream) << "{";
|
||||
@@ -190,10 +190,10 @@ static void pprint_r(Inspector &insp, int level, LuaSlot root) {
|
||||
LS.rawget(val, pairs, i+1);
|
||||
if (needcomma) (*insp.stream) << ",";
|
||||
needcomma = true;
|
||||
if (LS.isnumber(key) && (LS.ckint(key) == nextseq)) {
|
||||
if (LS.rawequal(key, nextseq)) {
|
||||
(*insp.stream) << " ";
|
||||
pprint_r(insp, level + 1, val);
|
||||
nextseq = nextseq + 1;
|
||||
LS.set(nextseq, LS.ckinteger(nextseq) + 1);
|
||||
} else {
|
||||
multiline = true;
|
||||
tabify(insp, level + 1);
|
||||
@@ -227,7 +227,7 @@ static void pprint_r(Inspector &insp, int level, LuaSlot root) {
|
||||
// Close the brackets.
|
||||
if (multiline) {
|
||||
tabify(insp, level);
|
||||
} else if (nextseq > 1) {
|
||||
} else if (LS.ckinteger(nextseq) > 1) {
|
||||
(*insp.stream) << " ";
|
||||
}
|
||||
(*insp.stream) << "}";
|
||||
|
||||
Reference in New Issue
Block a user