Module:Universe: Difference between revisions
From PC Gaming Shelter
Created page with "local utils = require( 'Module:Utils' ) local p = {} local function getCurrentGame() local title = mw.title.getCurrentTitle() local game = title.rootText -- return tostring(game) return 'Star Trek: Voyager - Elite Force' end function p.Mods() local query = { '|Maps||Skins||UtilitiesRelated game::' .. getCurrentGame() .. '' } return mw.smw.ask(query) end function p.Players() local query = { 'Category:Players[[Plays game::' .. g..." |
No edit summary |
||
| Line 6: | Line 6: | ||
local title = mw.title.getCurrentTitle() | local title = mw.title.getCurrentTitle() | ||
local game = title.rootText | local game = title.rootText | ||
return tostring(game) | |||
end | end | ||
function p.Mods() | function p.Mods(frame) | ||
local game = getCurrentGame() | |||
local query = { | local query = { | ||
'[[Category:Mods||Maps||Skins||Utilities]][[Related game::' .. | '[[Category:Mods||Maps||Skins||Utilities]][[Related game::' .. game .. ']]' | ||
} | } | ||
local data = mw.smw.ask(query) | |||
local forminput = frame:callParserFunction({ '#forminput', '', args = { | |||
'form=Mod', | |||
'query string=Mod[Related game]=' .. game, | |||
'button text=Create or Edit Mod', | |||
'autofocus=no' | |||
}}) | |||
local html = mw.html.create() | |||
return forminput | |||
end | end | ||
Revision as of 09:44, 31 July 2026
Documentation for this module may be created at Module:Universe/doc
local utils = require( 'Module:Utils' )
local p = {}
local function getCurrentGame()
local title = mw.title.getCurrentTitle()
local game = title.rootText
return tostring(game)
end
function p.Mods(frame)
local game = getCurrentGame()
local query = {
'[[Category:Mods||Maps||Skins||Utilities]][[Related game::' .. game .. ']]'
}
local data = mw.smw.ask(query)
local forminput = frame:callParserFunction({ '#forminput', '', args = {
'form=Mod',
'query string=Mod[Related game]=' .. game,
'button text=Create or Edit Mod',
'autofocus=no'
}})
local html = mw.html.create()
return forminput
end
function p.Players()
local query = {
'[[Category:Players]][[Plays game::' .. getCurrentGame() .. ']]'
}
return mw.smw.ask(query)
end
function p.Clans()
local query = {
'[[Category:Communities]][[Related game::' .. getCurrentGame() .. ']]'
}
return mw.smw.ask(query)
end
return p
