Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Fonction récursive pour afficher les tables
- local function printTable(t, indent)
- indent = indent or ""
- for k, v in pairs(t) do
- if type(v) == "table" then
- print(indent .. tostring(k) .. ":")
- printTable(v, indent .. " ")
- else
- print(indent .. tostring(k) .. ": " .. tostring(v))
- end
- end
- end
- -- Simple visualiseur de trades
- local shop = peripheral.wrap("right")
- if not shop then
- print("Shop non trouve")
- return
- end
- local trades = shop.getTrades()
- if not trades then
- print("Pas de trades")
- return
- end
- print("=== TRADES ===")
- print("Nombre: " .. #trades)
- print()
- for i, trade in ipairs(trades) do
- print("--- Trade " .. i .. " ---")
- for key, value in pairs(trade) do
- if type(value) == "table" then
- print(key .. ":")
- printTable(value, " ")
- else
- print(key .. ": " .. tostring(value))
- end
- end
- print()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement