Implement LuaExtraArgs

This commit is contained in:
2023-04-13 13:26:45 -04:00
parent cf8b573364
commit 30155ae388
4 changed files with 126 additions and 74 deletions

View File

@@ -728,14 +728,12 @@ LuaDefine(pprint, "obj1, obj2, ...",
"|") {
World *w = World::fetch_global_pointer(L);
std::ostream *ostream = w->lthread_print_stream();
int n = lua_gettop(L);
LuaDefStack LS(L);
for (int i = 1; i <= n; i++) {
LuaSpecial root(i);
pprint(LS, root, PrettyPrintOptions(), ostream);
if (i < n) (*ostream) << "\n";
LuaExtraArgs extra;
LuaDefStack LS(L, extra);
for (int i = 0; i < extra.size(); i++) {
pprint(LS, extra[i], PrettyPrintOptions(), ostream);
(*ostream) << std::endl;
}
(*ostream) << std::endl;
return LS.result();
}