MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / PrintTable

Function PrintTable

src/Chain/libraries/glua/glua_decompile.cpp:1046–1091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1044}
1045
1046std::string PrintTable(GluaDecompileContextP ctx, Function* F, int r, int returnCopy) {
1047 std::string result;
1048 int numerics = 0;
1049 DecTableItem* item;
1050 std::stringstream str;
1051 DecTable* tbl = (DecTable*)FindFromListTail(&(F->tables), (ListItemCmpFn)MatchTable, &r);
1052 if (tbl == nullptr) {
1053 IS_TABLE(r) = 0;
1054 return F->R[r];
1055 }
1056 item = lua_cast(DecTableItem*, tbl->array.head);
1057 if (item) {
1058 numerics = 1;
1059 PrintTableItemNumeric(str, item);
1060 item = lua_cast(DecTableItem*, item->super.next);
1061 while (item) {
1062 str << ", ";
1063 PrintTableItemNumeric(str, item);
1064 item = lua_cast(DecTableItem*, item->super.next);
1065 }
1066 }
1067 item = lua_cast(DecTableItem*, tbl->keyed.head);
1068 if (item) {
1069 if (numerics) {
1070 str << "; ";
1071 }
1072 PrintTableItemKeyed(ctx, F, str, item);
1073 item = lua_cast(DecTableItem*, item->super.next);
1074 while (item) {
1075 str << ", ";
1076 PrintTableItemKeyed(ctx, F, str, item);
1077 item = lua_cast(DecTableItem*, item->super.next);
1078 }
1079 }
1080 str << "}";
1081 PENDING(r) = 0;
1082 AssignReg(ctx, F, r, str.str().c_str(), 0, 0);
1083 if (ctx->error.length()>0) {
1084 result = "";
1085 }
1086 else if (returnCopy) {
1087 result = str.str();
1088 }
1089 CloseTable(F, r);
1090 return result;
1091}
1092
1093DecTable* NewTable(int r, int b, int c, int pc) {
1094 auto self = new DecTable();

Callers 1

GetRFunction · 0.70

Calls 8

FindFromListTailFunction · 0.85
PrintTableItemNumericFunction · 0.85
PrintTableItemKeyedFunction · 0.85
AssignRegFunction · 0.85
CloseTableFunction · 0.85
c_strMethod · 0.45
strMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected