(just need this somewhere) Tag: sourceedit |
mNo edit summary Tag: sourceedit |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local p = {} |
local p = {} |
||
⚫ | |||
⚫ | |||
+ | ['['] = '[', |
||
− | local json = '[ { "name": "Infernal ashes", "quantity": [1,1], "rarity": "Always" }, { "name": "Adamant battleaxe", "quantity": [1,1], "rarity": "Common" }, { "name": "Rune dagger", "quantity": [1,1], "rarity": "Common" }, { "name": "Abyssal whip", "quantity": [1,1], "rarity": "Very rare" }, { "name": "Rune chainbody", "quantity": [1,1], "rarity": "Uncommon" }, { "name": "Rune helm", "quantity": [1,1], "rarity": "Uncommon" }, { "name": "Coins", "quantity": [1920,3600], "rarity": "Common" }, { "name": "Shark", "quantity": [1,1], "rarity": "Uncommon" }, { "name": "Pure essence", "quantity": [72,152], "rarity": "Common" }, { "name": "Uncut ruby", "quantity": [1,1], "rarity": "Common" }, { "name": "Uncut diamond", "quantity": [1,1], "rarity": "Uncommon" }, { "name": "Adamantite ore", "quantity": [2,2], "rarity": "Uncommon" }, { "name": "Magic logs", "quantity": [6,6], "rarity": "Uncommon" }, { "name": "Fire orb", "quantity": [2,2], "rarity": "Uncommon" }, { "name": "Uncut dragonstone", "quantity": [1,1], "rarity": "Rare" }, { "name": "Runite ore", "quantity": [1,1], "rarity": "Rare" }, { "name": "Rare drop table", "quantity": [1,1], "rarity": "Rare" }, { "name": "Abyssal wand", "quantity": [1,1], "rarity": "Very rare" }, { "name": "Abyssal orb", "quantity": [1,1], "rarity": "Very rare" }, { "name": "Ferocious ring", "quantity": [1,1], "rarity": "Uncommon" }, { "name": "Clue scroll (hard)", "quantity": [1,1], "rarity": "Uncommon" }, { "name": "Court summons", "quantity": [1,1], "rarity": "Rare" }, { "name": "Spirit sapphire", "quantity": [1,1], "rarity": "Rare" }, { "name": "Spirit emerald", "quantity": [1,1], "rarity": "Rare" }, { "name": "Spirit ruby", "quantity": [1,1], "rarity": "Rare" }, { "name": "Crystal triskelion fragment 1", "quantity": [1,1], "rarity": "Very rare" }, { "name": "Crystal triskelion fragment 2", "quantity": [1,1], "rarity": "Very rare" }, { "name": "Crystal triskelion fragment 3", "quantity": [1,1], "rarity": "Very rare" }, { "name": "Starved ancient effigy", "quantity": [1,1], "rarity": "Very rare" }, { "name": "Abyssal head", "quantity": [1,1], "rarity": "Very rare" }, { "name": "Key token", "quantity": [1,1], "rarity": "Rare" } ]' |
||
+ | [']'] = ']', |
||
− | |||
+ | ['{'] = '{', |
||
− | for i,v in pairs(mw.text.jsonDecode(json)) do |
||
+ | ['|'] = '|', |
||
⚫ | |||
+ | ['}'] = '}', |
||
− | if type(v) == 'table' then |
||
+ | } |
||
⚫ | |||
+ | |||
− | end |
||
⚫ | |||
− | mw.log(string.format('Drop: %s | Quantity: %s-%s | Rarity: %s',v.name,v.quantity[1],v.quantity[2],v.rarity)) |
||
+ | s = mw.text.split(s,'') |
||
+ | local ret = {} |
||
+ | for _, v in ipairs(s) do |
||
+ | table.insert(ret,escapes[v] or v) |
||
end |
end |
||
+ | |||
⚫ | |||
end |
end |
||
Latest revision as of 16:14, 26 May 2016
Documentation for this module may be created at Module:JSON/doc