| 651 | static void lua_save_data_write_value(lua_State *L, int i, StringStream &sjson, u32 depth); |
| 652 | |
| 653 | static void lua_save_data_write_table(lua_State *L, int i, StringStream &sjson, u32 depth, bool root, bool force_regular) |
| 654 | { |
| 655 | i = lua_abs_index(L, i); |
| 656 | const u32 child_depth = root ? depth : depth + 1; |
| 657 | |
| 658 | if (!force_regular && lua_save_data_table_collides_with_typed_object(L, i)) { |
| 659 | if (!root) |
| 660 | sjson << "{\n"; |
| 661 | |
| 662 | lua_save_data_write_indent(sjson, child_depth); |
| 663 | sjson << "type = \"table\"\n"; |
| 664 | lua_save_data_write_indent(sjson, child_depth); |
| 665 | sjson << "data = "; |
| 666 | lua_save_data_write_table(L, i, sjson, child_depth, false, true); |
| 667 | |
| 668 | sjson << "\n"; |
| 669 | if (!root) { |
| 670 | lua_save_data_write_indent(sjson, depth); |
| 671 | sjson << "}"; |
| 672 | } |
| 673 | return; |
| 674 | } |
| 675 | |
| 676 | if (!root) |
| 677 | sjson << "{\n"; |
| 678 | |
| 679 | lua_pushnil(L); |
| 680 | while (lua_next(L, i) != 0) { |
| 681 | lua_save_data_write_indent(sjson, child_depth); |
| 682 | lua_save_data_write_key(sjson, L, -2); |
| 683 | sjson << " = "; |
| 684 | lua_save_data_write_value(L, -1, sjson, child_depth); |
| 685 | sjson << "\n"; |
| 686 | lua_pop(L, 1); |
| 687 | } |
| 688 | |
| 689 | if (!root) { |
| 690 | lua_save_data_write_indent(sjson, depth); |
| 691 | sjson << "}"; |
| 692 | } |
| 693 | } |
| 694 | |
| 695 | static void lua_save_data_write_value(lua_State *L, int i, StringStream &sjson, u32 depth) |
| 696 | { |
no test coverage detected