Module:VillageTest: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local capiunto = require 'capiunto' | |||
| Line 46: | Line 46: | ||
}) | }) | ||
local retval = capiunto.create({ | |||
top = 'TESTING', | |||
bodyClass = 'icr-DiamondCitizenBodyStyle', | |||
topClass = 'icr-title' | |||
}) | |||
retval:addRow('HOWDY', 'HOWDEE', '', 'icr-transparency1 icr-data') | |||
local villagels = {} | local villagels = {} | ||
| Line 56: | Line 62: | ||
for village in pairs(playerVillages.data[role]) do | for village in pairs(playerVillages.data[role]) do | ||
table.insert(villagels, village) | table.insert(villagels, village) | ||
retval:addRow('HOWDY', village, '', 'icr-transparency1 icr-data') | |||
end | end | ||
| Line 64: | Line 71: | ||
return villagels | return villagels | ||
end | end | ||
return retval | |||
end | end | ||
return p | return p | ||
Revision as of 17:39, 17 January 2025
Documentation for this module may be created at Module:VillageTest/doc
local p = {}
local capiunto = require 'capiunto'
--[ Thecow275's WikiStats V2 VIllages MODULE PROTOTYPE ]
--[ Nicknamed: UUID and J-Village Update]
local function preprocessArg(s)
if not s then
return nil
end
s = s:match('^%s*(.-)%s*$') --trim whitespace
if s == '' then
return nil
else
return s
end
end
function p.main(frame)
local args = frame.args
--local input = preprocessArg(args[1])
-- local datatype = preprocessArg(args[2]) -- currently unused will be used whenever I implement more datatypes
-- local UUIDORUSER = preprocessArg(args[3]) -- Selector for if input is username OR UUID
-- local PlayerORVillage = preprocessArg(args[4]) -- Jesus christ argument just so you can specify if you are searching for village data YES village data
-- this module will get bloated with the jvillage stuff but EHHH
--if not input then -- CHECK FOR BLANK INPUT
-- return 'INPUT ERROR INPUT IS NULL'
--end
local uuid = '8fa8f70d-eb7d-4743-b0ad-837cdfb69f4e'
local villagedata = mw.ext.externalData.getExternalData({
url = "api.retromc.org/api/v1/village/getVillageList",
format = 'json'
})
local playerVillages = mw.ext.externalData.getExternalData({
url = "https://statistics.retromc.org/api/user_villages?uuid=" .. uuid,
data = 'data',
format = 'json'
})
local retval = capiunto.create({
top = 'TESTING',
bodyClass = 'icr-DiamondCitizenBodyStyle',
topClass = 'icr-title'
})
retval:addRow('HOWDY', 'HOWDEE', '', 'icr-transparency1 icr-data')
local villagels = {}
if playerVillages.data then
for role in pairs({"member"}) do --maybe this needs to be for pairs in data and then again for ipairs in owner, member and assistant ? so maybe I need to create 2 tables for this and then handle it through that ?
if playerVillages.data[role] then
for village in pairs(playerVillages.data[role]) do
table.insert(villagels, village)
retval:addRow('HOWDY', village, '', 'icr-transparency1 icr-data')
end
end
end
return villagels
end
return retval
end
return p