SHOW:
|
|
- or go back to the newest paste.
1 | - | for test in pairs(component.debug.getWorld().getTileNBT(math.floor(component.debug.getX()),math.floor(component.debug.getY()+1),math.floor(component.debug.getZ())+1).value.Items) do |
1 | + | local nbt_data = component.debug.getWorld().getTileNBT(math.floor(component.debug.getX()),math.floor(component.debug.getY()+1),math.floor(component.debug.getZ())+1).value.Items |
2 | - | print(test) |
2 | + | |
3 | - | end |
3 | + | local function printTable(tbl, depth) |
4 | local depth = (depth or 0) | |
5 | for key, value in pairs(tbl) do | |
6 | if type(value) == "table" then | |
7 | printTable(value, depth + 1) | |
8 | else | |
9 | print(string.rep(".", (depth or 0)) .. key, value) | |
10 | end | |
11 | end | |
12 | ||
13 | print("Recursive function:") | |
14 | printTable(nbt_data) | |
15 | print("Serialized table:") | |
16 | print(serialization.serialize(nbt_data, true)) |