Advertisement
giwdul

Untitled

Jun 11th, 2025 (edited)
1,278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | None | 0 0
  1. -- Fonction récursive pour afficher les tables
  2. local function printTable(t, indent)
  3.     indent = indent or ""
  4.     for k, v in pairs(t) do
  5.         if type(v) == "table" then
  6.             print(indent .. tostring(k) .. ":")
  7.             printTable(v, indent .. "  ")
  8.         else
  9.             print(indent .. tostring(k) .. ": " .. tostring(v))
  10.         end
  11.     end
  12. end
  13.  
  14. -- Simple visualiseur de trades
  15. local shop = peripheral.wrap("right")
  16.  
  17. if not shop then
  18.     print("Shop non trouve")
  19.     return
  20. end
  21.  
  22. local trades = shop.getTrades()
  23.  
  24. if not trades then
  25.     print("Pas de trades")
  26.     return
  27. end
  28.  
  29. print("=== TRADES ===")
  30. print("Nombre: " .. #trades)
  31. print()
  32.  
  33. for i, trade in ipairs(trades) do
  34.     print("--- Trade " .. i .. " ---")
  35.     for key, value in pairs(trade) do
  36.         if type(value) == "table" then
  37.             print(key .. ":")
  38.             printTable(value, "  ")
  39.         else
  40.             print(key .. ": " .. tostring(value))
  41.         end
  42.     end
  43.     print()
  44. end
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement