پودمان:AlborzSports: تفاوت میان نسخهها
ظاهر
جزبدون خلاصۀ ویرایش |
جزبدون خلاصۀ ویرایش |
||
| خط ۳: | خط ۳: | ||
-- Wiki Alborz Sports Information System | -- Wiki Alborz Sports Information System | ||
-- Core Engine | -- Core Engine | ||
-- Version 2. | -- Version 2.2 | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
| خط ۱۲: | خط ۱۲: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
local data = | local data = mw.loadData("Module:AlborzSports/Data") | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
| خط ۴۱: | خط ۳۳: | ||
if type(value) == "string" then | if type(value) == "string" then | ||
value = | value = mw.text.trim(value) | ||
if value == "" then | if value == "" then | ||
| خط ۵۱: | خط ۴۲: | ||
return value | return value | ||
end | end | ||
| خط ۸۸: | خط ۵۲: | ||
local args = {} | local args = {} | ||
local source = | local source = frame | ||
local parent = frame:getParent() | |||
if parent and next(parent.args) then | if parent and next(parent.args) then | ||
source = parent | |||
source = | |||
end | end | ||
for k, v in pairs(source.args) do | for k, v in pairs(source.args) do | ||
local key = | local key = mw.text.trim(k) | ||
local value = clean(v) | |||
if value then | if value then | ||
args[key] = value | |||
args[key] = | |||
end | end | ||
end | end | ||
return args | return args | ||
end | end | ||
| خط ۱۳۳: | خط ۸۲: | ||
local result = {} | local result = {} | ||
for key, value in pairs(args) do | for key, value in pairs(args) do | ||
local field = | local field = | ||
data.lookup[key] | data.lookup[key] or key | ||
result[field] = | result[field] = value | ||
end | end | ||
return result | return result | ||
end | end | ||
| خط ۱۵۹: | خط ۱۰۲: | ||
local entity = | local entity = | ||
args.entity_type | clean(args.entity_type) | ||
if not entity then | if not entity then | ||
| خط ۱۶۸: | خط ۱۱۰: | ||
end | end | ||
if data.entities[entity] then | if data.entities[entity] then | ||
return entity | return entity | ||
end | end | ||
return "player" | return "player" | ||
end | end | ||
| خط ۱۸۸: | خط ۱۲۵: | ||
if args.name then | if args.name then | ||
return args.name | return args.name | ||
end | end | ||
if data.entities[entity] then | if data.entities[entity] then | ||
return data.entities[entity].title | return data.entities[entity].title | ||
end | end | ||
return data.meta.title | return data.meta.title | ||
end | end | ||
| خط ۲۱۲: | خط ۱۴۲: | ||
if not args.image then | if not args.image then | ||
return nil | return nil | ||
end | end | ||
local width = | local width = | ||
args.image_width | args.image_width | ||
or DEFAULT_IMAGE_WIDTH | or DEFAULT_IMAGE_WIDTH | ||
local caption = | local caption = | ||
args.caption | args.caption or "" | ||
return { | return { | ||
| خط ۲۳۹: | خط ۱۶۳: | ||
} | } | ||
end | end | ||
| خط ۲۴۶: | خط ۱۶۹: | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
local function buildFields( | local function buildFields(layouts, args) | ||
local fields = {} | local fields = {} | ||
for _, layout in ipairs(layouts) do | |||
local label = layout[1] | |||
local label = | |||
local key = layout[2] | |||
local value = | local value = | ||
args[key] | clean(args[key]) | ||
---------------------------------------------------------------- | |||
-- ONLY ADD EXISTING VALUES | |||
---------------------------------------------------------------- | |||
if value then | if value then | ||
table.insert( | table.insert(fields, { | ||
label = label, | |||
value = value | |||
}) | |||
end | end | ||
end | end | ||
return fields | return fields | ||
end | end | ||
| خط ۳۰۰: | خط ۲۱۰: | ||
local groups = {} | local groups = {} | ||
local entityData = | local entityData = | ||
data.entities[entity] | data.entities[entity] | ||
if not entityData then | if not entityData then | ||
return groups | return groups | ||
end | end | ||
for _, layoutName in ipairs(entityData.layouts) do | for _, layoutName in ipairs(entityData.layouts) do | ||
| خط ۳۱۷: | خط ۲۲۲: | ||
local layout = | local layout = | ||
data.layouts[layoutName] | data.layouts[layoutName] | ||
if layout then | if layout then | ||
local fields = | local fields = | ||
buildFields( | buildFields(layout, args) | ||
if #fields > 0 then | if #fields > 0 then | ||
table.insert( | table.insert(groups, { | ||
name = | |||
data.layoutTitles[layoutName] | |||
or layoutName, | |||
fields = fields | |||
}) | |||
end | end | ||
| خط ۳۵۵: | خط ۲۴۵: | ||
end | end | ||
return groups | return groups | ||
end | end | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- MEDAL BUILDER | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
local function | local function buildMedals(args) | ||
local medals = | local medals = | ||
args.medaltemplates | clean(args.medaltemplates) | ||
if not medals then | |||
if not | |||
medals = | medals = | ||
args.medals | clean(args.medals) | ||
end | end | ||
if not medals then | |||
if not | |||
return nil | return nil | ||
end | end | ||
local frame = | local frame = | ||
mw.getCurrentFrame() | mw.getCurrentFrame() | ||
local content = | local content = | ||
frame:expandTemplate{ | frame:expandTemplate{ | ||
title = | title = "Infobox medal templates", | ||
args = { | args = { | ||
medals = | medals = medals, | ||
title = | title = | ||
| خط ۴۷۰: | خط ۲۸۵: | ||
or "", | or "", | ||
expand = | expand = "yes" | ||
} | } | ||
| خط ۴۷۷: | خط ۲۹۱: | ||
} | } | ||
content = clean(content) | |||
if not | if not content then | ||
return nil | return nil | ||
end | end | ||
return content | return content | ||
end | end | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- | -- INFOBOX BUILDER | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
local function | local function buildInfobox(entity, args) | ||
local box = {} | |||
---------------------------------------------------------------- | |||
-- TITLE | |||
---------------------------------------------------------------- | |||
box.title = | |||
getTitle(entity, args) | |||
---------------------------------------------------------------- | |||
-- IMAGE | |||
---------------------------------------------------------------- | |||
local image = | |||
buildImage(args) | |||
if image then | |||
box.image = image | |||
end | |||
---------------------------------------------------------------- | |||
-- GROUPS | |||
---------------------------------------------------------------- | |||
box.groups = | |||
buildGroups(entity, args) | |||
---------------------------------------------------------------- | |||
-- MEDALS | |||
---------------------------------------------------------------- | |||
box.medals = | |||
buildMedals(args) | |||
return box | |||
end | end | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
-- RENDER | -- RENDER VALUE | ||
-------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ||
local function | local function renderValue(value) | ||
if type(value) == "table" then | |||
return table.concat( | |||
value, | |||
"، " | |||
) | |||
end | |||
return tostring(value) | |||
end | |||
-------------------------------------------------------------------------------- | |||
-- RENDER INFOBOX | |||
-------------------------------------------------------------------------------- | |||
local function renderInfobox(box) | |||
local result = {} | |||
------------------------------------------------------------ | ---------------------------------------------------------------- | ||
-- OPEN | -- OPEN TABLE | ||
------------------------------------------------------------ | ---------------------------------------------------------------- | ||
table.insert( | table.insert( | ||
result, | result, | ||
'<table class="sport-infobox">' | '<table class="sport-infobox">' | ||
) | ) | ||
---------------------------------------------------------------- | |||
------------------------------------------------------------ | |||
-- TITLE | -- TITLE | ||
------------------------------------------------------------ | ---------------------------------------------------------------- | ||
if box.title then | if box.title then | ||
table.insert( | table.insert( | ||
result, | result, | ||
'<tr class="sport-infobox-title">' .. | '<tr class="sport-infobox-title">' .. | ||
'<th colspan="2">' .. | '<th colspan="2">' .. | ||
box.title .. | box.title .. | ||
'</th></tr>' | |||
'</th> | |||
) | ) | ||
| خط ۵۷۶: | خط ۳۹۶: | ||
end | end | ||
---------------------------------------------------------------- | |||
------------------------------------------------------------ | |||
-- IMAGE | -- IMAGE | ||
------------------------------------------------------------ | ---------------------------------------------------------------- | ||
if box.image then | if box.image then | ||
| خط ۵۸۵: | خط ۴۰۴: | ||
local image = | local image = | ||
box.image | box.image | ||
local file = | local file = | ||
image.image | image.image | ||
local size = | local size = | ||
image.size | image.size | ||
or DEFAULT_IMAGE_WIDTH | or DEFAULT_IMAGE_WIDTH | ||
local caption = | local caption = | ||
image.caption | image.caption | ||
or "" | or "" | ||
table.insert( | table.insert( | ||
result, | result, | ||
'<tr>' .. | '<tr>' .. | ||
'<td colspan="2" class="sport-infobox-image">' .. | '<td colspan="2" class="sport-infobox-image">' .. | ||
'[[File:' .. | '[[File:' .. | ||
file .. | file .. | ||
'|' .. | '|' .. | ||
size .. | size .. | ||
']]' | ']]' | ||
) | ) | ||
if caption ~= "" then | if caption ~= "" then | ||
table.insert( | table.insert( | ||
result, | result, | ||
'<div class="sport-infobox-caption">' .. | '<div class="sport-infobox-caption">' .. | ||
caption .. | caption .. | ||
'</div>' | '</div>' | ||
| خط ۶۳۷: | خط ۴۴۱: | ||
end | end | ||
table.insert( | table.insert( | ||
result, | result, | ||
'</td></tr>' | |||
'</td> | |||
) | ) | ||
end | end | ||
---------------------------------------------------------------- | |||
------------------------------------------------------------ | |||
-- GROUPS | -- GROUPS | ||
------------------------------------------------------------ | ---------------------------------------------------------------- | ||
for _, group in ipairs(box.groups) do | for _, group in ipairs(box.groups) do | ||
table.insert( | table.insert( | ||
result, | result, | ||
'<tr class="sport-infobox-header">' .. | '<tr class="sport-infobox-header">' .. | ||
'<th colspan="2">' .. | '<th colspan="2">' .. | ||
group.name .. | group.name .. | ||
'</th></tr>' | |||
'</th> | |||
) | ) | ||
for _, field in ipairs(group.fields) do | for _, field in ipairs(group.fields) do | ||
table.insert( | table.insert( | ||
result, | result, | ||
| خط ۶۹۳: | خط ۴۷۳: | ||
'<th class="sport-infobox-label">' .. | '<th class="sport-infobox-label">' .. | ||
field.label .. | field.label .. | ||
'</th>' .. | '</th>' .. | ||
'<td class="sport-infobox-value">' .. | '<td class="sport-infobox-value">' .. | ||
renderValue(field.value) .. | renderValue(field.value) .. | ||
'</td>' .. | '</td>' .. | ||
| خط ۷۰۷: | خط ۴۸۳: | ||
) | ) | ||
end | end | ||
| خط ۷۴۶: | خط ۴۸۸: | ||
end | end | ||
---------------------------------------------------------------- | |||
-- MEDALS | |||
-- | |||
-- IMPORTANT: | |||
-- This is inserted BEFORE the closing </table>, | |||
-- so medals remain INSIDE the infobox. | |||
---------------------------------------------------------------- | |||
if box.medals then | |||
table.insert( | table.insert( | ||
result, | result, | ||
'<tr class="sport-infobox- | '<tr>' .. | ||
'<td colspan="2" class="sport-infobox-medals">' .. | |||
' | box.medals .. | ||
'</td>' .. | |||
'</tr>' | '</tr>' | ||
) | ) | ||
end | end | ||
---------------------------------------------------------------- | |||
------------------------------------------------------------ | -- CLOSE TABLE | ||
-- CLOSE | ---------------------------------------------------------------- | ||
------------------------------------------------------------ | |||
table.insert( | table.insert( | ||
result, | result, | ||
'</table>' | '</table>' | ||
) | ) | ||
return table.concat( | return table.concat( | ||
result, | result, | ||
"\n" | "\n" | ||
) | ) | ||
end | end | ||
| خط ۸۳۴: | خط ۵۳۵: | ||
getArgs(frame) | getArgs(frame) | ||
---------------------------------------------------------------- | |||
-- NORMALIZE ALL INPUTS | |||
---------------------------------------------------------------- | |||
args = | args = | ||
normalize(args) | normalize(args) | ||
---------------------------------------------------------------- | |||
-- ENTITY | |||
---------------------------------------------------------------- | |||
local entity = | local entity = | ||
getEntity(args) | getEntity(args) | ||
---------------------------------------------------------------- | |||
-- BUILD | |||
---------------------------------------------------------------- | |||
local box = | local box = | ||
| خط ۸۴۹: | خط ۵۵۹: | ||
) | ) | ||
---------------------------------------------------------------- | |||
-- RENDER | |||
---------------------------------------------------------------- | |||
return renderInfobox( | return renderInfobox(box) | ||
end | end | ||
| خط ۸۷۵: | خط ۵۸۵: | ||
local args = | local args = | ||
getArgs(frame) | getArgs(frame) | ||
args = | args = | ||
normalize(args) | normalize(args) | ||
local entity = | local entity = | ||
getEntity(args) | getEntity(args) | ||
local entityData = | local entityData = | ||
data.entities[entity] | data.entities[entity] | ||
if not entityData then | if not entityData then | ||
return "Entity not found" | return "Entity not found" | ||
end | end | ||
local result = {} | local result = {} | ||
table.insert( | |||
result, | |||
"Entity: " .. entity | |||
) | |||
table.insert( | table.insert( | ||
result, | |||
"Title: " .. entityData.title | |||
) | |||
table.insert( | |||
result, | result, | ||
" | "Layouts: " .. | ||
table.concat( | |||
entityData.layouts, | |||
", " | |||
) | |||
) | ) | ||
---------------------------------------------------------------- | |||
-- DEBUG COACH | |||
---------------------------------------------------------------- | |||
table.insert( | table.insert( | ||
result, | result, | ||
" | "Coach: " .. | ||
tostring( | |||
args.coach | |||
or "NOT FOUND" | |||
) | |||
) | ) | ||
---------------------------------------------------------------- | |||
-- DEBUG MEDALS | |||
---------------------------------------------------------------- | |||
table.insert( | table.insert( | ||
result, | result, | ||
" | "Medals: " .. | ||
tostring( | |||
args.medaltemplates | |||
or args.medals | |||
or "NOT FOUND" | |||
" | |||
) | ) | ||
) | ) | ||
return table.concat( | return table.concat( | ||
result, | result, | ||
"\n" | "\n" | ||
) | ) | ||
| خط ۹۵۳: | خط ۶۶۸: | ||
local result = {} | local result = {} | ||
for key, value in pairs(data.entities) do | for key, value in pairs(data.entities) do | ||
| خط ۹۶۹: | خط ۶۸۳: | ||
end | end | ||
table.sort(result) | |||
return table.concat( | return table.concat( | ||
result, | result, | ||
"\n" | "\n" | ||
) | ) | ||
نسخهٔ ۸ اوت ۲۰۲۶، ساعت ۲۲:۱۶
توضیحات این پودمان میتواند در پودمان:AlborzSports/توضیحات قرار گیرد.
--------------------------------------------------------------------------------
-- Module:AlborzSports
-- Wiki Alborz Sports Information System
-- Core Engine
-- Version 2.2
--------------------------------------------------------------------------------
local p = {}
--------------------------------------------------------------------------------
-- LOAD DATA
--------------------------------------------------------------------------------
local data = mw.loadData("Module:AlborzSports/Data")
--------------------------------------------------------------------------------
-- CONFIG
--------------------------------------------------------------------------------
local DEFAULT_IMAGE_WIDTH =
data.meta.imageWidth or "280px"
--------------------------------------------------------------------------------
-- UTILITY FUNCTIONS
--------------------------------------------------------------------------------
local function clean(value)
if value == nil then
return nil
end
if type(value) == "string" then
value = mw.text.trim(value)
if value == "" then
return nil
end
end
return value
end
--------------------------------------------------------------------------------
-- GET ARGUMENTS
--------------------------------------------------------------------------------
local function getArgs(frame)
local args = {}
local source = frame
local parent = frame:getParent()
if parent and next(parent.args) then
source = parent
end
for k, v in pairs(source.args) do
local key = mw.text.trim(k)
local value = clean(v)
if value then
args[key] = value
end
end
return args
end
--------------------------------------------------------------------------------
-- NORMALIZE INPUT
--------------------------------------------------------------------------------
local function normalize(args)
local result = {}
for key, value in pairs(args) do
local field =
data.lookup[key] or key
result[field] = value
end
return result
end
--------------------------------------------------------------------------------
-- ENTITY DETECTION
--------------------------------------------------------------------------------
local function getEntity(args)
local entity =
clean(args.entity_type)
if not entity then
entity =
data.defaults.entity_type
end
if data.entities[entity] then
return entity
end
return "player"
end
--------------------------------------------------------------------------------
-- TITLE
--------------------------------------------------------------------------------
local function getTitle(entity, args)
if args.name then
return args.name
end
if data.entities[entity] then
return data.entities[entity].title
end
return data.meta.title
end
--------------------------------------------------------------------------------
-- IMAGE HANDLING
--------------------------------------------------------------------------------
local function buildImage(args)
if not args.image then
return nil
end
local width =
args.image_width
or DEFAULT_IMAGE_WIDTH
local caption =
args.caption or ""
return {
type = "image",
image = args.image,
size = width,
caption = caption
}
end
--------------------------------------------------------------------------------
-- FIELD BUILDER
--------------------------------------------------------------------------------
local function buildFields(layouts, args)
local fields = {}
for _, layout in ipairs(layouts) do
local label = layout[1]
local key = layout[2]
local value =
clean(args[key])
----------------------------------------------------------------
-- ONLY ADD EXISTING VALUES
----------------------------------------------------------------
if value then
table.insert(fields, {
label = label,
value = value
})
end
end
return fields
end
--------------------------------------------------------------------------------
-- GROUP BUILDER
--------------------------------------------------------------------------------
local function buildGroups(entity, args)
local groups = {}
local entityData =
data.entities[entity]
if not entityData then
return groups
end
for _, layoutName in ipairs(entityData.layouts) do
local layout =
data.layouts[layoutName]
if layout then
local fields =
buildFields(layout, args)
if #fields > 0 then
table.insert(groups, {
name =
data.layoutTitles[layoutName]
or layoutName,
fields = fields
})
end
end
end
return groups
end
--------------------------------------------------------------------------------
-- MEDAL BUILDER
--------------------------------------------------------------------------------
local function buildMedals(args)
local medals =
clean(args.medaltemplates)
if not medals then
medals =
clean(args.medals)
end
if not medals then
return nil
end
local frame =
mw.getCurrentFrame()
local content =
frame:expandTemplate{
title = "Infobox medal templates",
args = {
medals = medals,
title =
args.medaltemplates_title
or "",
expand = "yes"
}
}
content = clean(content)
if not content then
return nil
end
return content
end
--------------------------------------------------------------------------------
-- INFOBOX BUILDER
--------------------------------------------------------------------------------
local function buildInfobox(entity, args)
local box = {}
----------------------------------------------------------------
-- TITLE
----------------------------------------------------------------
box.title =
getTitle(entity, args)
----------------------------------------------------------------
-- IMAGE
----------------------------------------------------------------
local image =
buildImage(args)
if image then
box.image = image
end
----------------------------------------------------------------
-- GROUPS
----------------------------------------------------------------
box.groups =
buildGroups(entity, args)
----------------------------------------------------------------
-- MEDALS
----------------------------------------------------------------
box.medals =
buildMedals(args)
return box
end
--------------------------------------------------------------------------------
-- RENDER VALUE
--------------------------------------------------------------------------------
local function renderValue(value)
if type(value) == "table" then
return table.concat(
value,
"، "
)
end
return tostring(value)
end
--------------------------------------------------------------------------------
-- RENDER INFOBOX
--------------------------------------------------------------------------------
local function renderInfobox(box)
local result = {}
----------------------------------------------------------------
-- OPEN TABLE
----------------------------------------------------------------
table.insert(
result,
'<table class="sport-infobox">'
)
----------------------------------------------------------------
-- TITLE
----------------------------------------------------------------
if box.title then
table.insert(
result,
'<tr class="sport-infobox-title">' ..
'<th colspan="2">' ..
box.title ..
'</th></tr>'
)
end
----------------------------------------------------------------
-- IMAGE
----------------------------------------------------------------
if box.image then
local image =
box.image
local file =
image.image
local size =
image.size
or DEFAULT_IMAGE_WIDTH
local caption =
image.caption
or ""
table.insert(
result,
'<tr>' ..
'<td colspan="2" class="sport-infobox-image">' ..
'[[File:' ..
file ..
'|' ..
size ..
']]'
)
if caption ~= "" then
table.insert(
result,
'<div class="sport-infobox-caption">' ..
caption ..
'</div>'
)
end
table.insert(
result,
'</td></tr>'
)
end
----------------------------------------------------------------
-- GROUPS
----------------------------------------------------------------
for _, group in ipairs(box.groups) do
table.insert(
result,
'<tr class="sport-infobox-header">' ..
'<th colspan="2">' ..
group.name ..
'</th></tr>'
)
for _, field in ipairs(group.fields) do
table.insert(
result,
'<tr>' ..
'<th class="sport-infobox-label">' ..
field.label ..
'</th>' ..
'<td class="sport-infobox-value">' ..
renderValue(field.value) ..
'</td>' ..
'</tr>'
)
end
end
----------------------------------------------------------------
-- MEDALS
--
-- IMPORTANT:
-- This is inserted BEFORE the closing </table>,
-- so medals remain INSIDE the infobox.
----------------------------------------------------------------
if box.medals then
table.insert(
result,
'<tr>' ..
'<td colspan="2" class="sport-infobox-medals">' ..
box.medals ..
'</td>' ..
'</tr>'
)
end
----------------------------------------------------------------
-- CLOSE TABLE
----------------------------------------------------------------
table.insert(
result,
'</table>'
)
return table.concat(
result,
"\n"
)
end
--------------------------------------------------------------------------------
-- PUBLIC FUNCTION
--------------------------------------------------------------------------------
function p.main(frame)
local args =
getArgs(frame)
----------------------------------------------------------------
-- NORMALIZE ALL INPUTS
----------------------------------------------------------------
args =
normalize(args)
----------------------------------------------------------------
-- ENTITY
----------------------------------------------------------------
local entity =
getEntity(args)
----------------------------------------------------------------
-- BUILD
----------------------------------------------------------------
local box =
buildInfobox(
entity,
args
)
----------------------------------------------------------------
-- RENDER
----------------------------------------------------------------
return renderInfobox(box)
end
--------------------------------------------------------------------------------
-- TEMPLATE ENTRY
--------------------------------------------------------------------------------
function p.infobox(frame)
return p.main(frame)
end
--------------------------------------------------------------------------------
-- DEBUG FUNCTION
--------------------------------------------------------------------------------
function p.test(frame)
local args =
getArgs(frame)
args =
normalize(args)
local entity =
getEntity(args)
local entityData =
data.entities[entity]
if not entityData then
return "Entity not found"
end
local result = {}
table.insert(
result,
"Entity: " .. entity
)
table.insert(
result,
"Title: " .. entityData.title
)
table.insert(
result,
"Layouts: " ..
table.concat(
entityData.layouts,
", "
)
)
----------------------------------------------------------------
-- DEBUG COACH
----------------------------------------------------------------
table.insert(
result,
"Coach: " ..
tostring(
args.coach
or "NOT FOUND"
)
)
----------------------------------------------------------------
-- DEBUG MEDALS
----------------------------------------------------------------
table.insert(
result,
"Medals: " ..
tostring(
args.medaltemplates
or args.medals
or "NOT FOUND"
)
)
return table.concat(
result,
"\n"
)
end
--------------------------------------------------------------------------------
-- GET ENTITY LIST
--------------------------------------------------------------------------------
function p.entities()
local result = {}
for key, value in pairs(data.entities) do
table.insert(
result,
key ..
" : " ..
value.title
)
end
table.sort(result)
return table.concat(
result,
"\n"
)
end
--------------------------------------------------------------------------------
-- GET VERSION
--------------------------------------------------------------------------------
function p.version()
return
data.version.name ..
" v" ..
data.version.major ..
"." ..
data.version.minor
end
--------------------------------------------------------------------------------
-- EXPORT
--------------------------------------------------------------------------------
return p