Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Programme pour recuperer le nom du proprietaire d'un shop Lightman Currency
- -- Configuration
- local SHOP_SIDE = "right" -- Direction du shop
- -- Connexion au shop
- local shop = peripheral.wrap(SHOP_SIDE)
- -- Verification
- if not shop then
- print("❌ Erreur: Shop non trouve sur " .. SHOP_SIDE)
- print("Peripheriques disponibles:")
- for _, name in pairs(peripheral.getNames()) do
- print(" - " .. name .. " (" .. peripheral.getType(name) .. ")")
- end
- return
- end
- print("=== VERIFICATEUR DE PROPRIETAIRE ===")
- print("Shop detecte: " .. peripheral.getType(SHOP_SIDE))
- print()
- -- Fonction pour obtenir le nom du proprietaire
- function getShopOwner()
- if not shop.getOwnerName then
- return false, "Fonction getOwnerName non disponible"
- end
- local success, owner = pcall(function()
- return shop.getOwnerName()
- end)
- return success, owner
- end
- -- Recuperer le proprietaire
- local success, owner = getShopOwner()
- if success then
- if owner and owner ~= "" then
- print("✅ Proprietaire du shop: " .. owner)
- else
- print("❓ Shop sans proprietaire ou proprietaire vide")
- end
- else
- print("❌ Erreur lors de la recuperation: " .. tostring(owner))
- end
- print()
- -- Informations supplementaires si disponibles
- print("=== INFORMATIONS SUPPLEMENTAIRES ===")
- -- Essayer d'autres fonctions utiles
- local functions_to_test = {
- {name = "getTrades", description = "Trades disponibles"},
- {name = "getName", description = "Nom du shop"},
- {name = "size", description = "Taille de l'inventaire"}
- }
- for _, func_info in ipairs(functions_to_test) do
- if shop[func_info.name] then
- local success, result = pcall(function()
- return shop[func_info.name]()
- end)
- if success then
- print("✅ " .. func_info.description .. ":")
- if type(result) == "table" then
- print(" Type: table (contient " .. #result .. " elements)")
- -- Afficher les premiers elements si c'est une liste
- for i = 1, math.min(3, #result) do
- print(" [" .. i .. "]: " .. tostring(result[i]))
- end
- if #result > 3 then
- print(" ... et " .. (#result - 3) .. " de plus")
- end
- else
- print(" Valeur: " .. tostring(result))
- end
- else
- print("❌ " .. func_info.description .. ": " .. tostring(result))
- end
- else
- print("❓ " .. func_info.description .. ": fonction non disponible")
- end
- end
- print()
- print("=== RESUME ===")
- if success and owner and owner ~= "" then
- print("🏪 Shop appartient a: " .. owner)
- else
- print("❓ Proprietaire non determine")
- end
- print("Analyse terminee.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement