Module:Illustration: Difference between revisions

From Terra Invicta Official Wiki
Llamageddon (talk | contribs)
mNo edit summary
Llamageddon (talk | contribs)
mNo edit summary
Line 6: Line 6:
local illusData = mw.loadData('Module:Illustration/data')
local illusData = mw.loadData('Module:Illustration/data')


-- Currently just trying to get this to output all entries for a key into a readable string, to test the basics work.
function p.Illusnametest (frame)
function p.Illusnametest (frame)
local illusdataName = frame.args[1]
local illusdataName = frame.args[1]
if illusdataName[illusData] then
if illusdataName[illusData] then
-- Am just infering that "j" counts entries for a key (no idea about correct syntax here really).
local Illustrations = {}
local Illustrations = {}
for j = 0, 5 do
for j = 0, 5 do
-- Am assuming tinsert is just an array for passing on data
local illusFile = {}
local illusFile = {}
if illusData[illusdataName][j] and illusData[illusdataName][j] ~= '' then
if illusData[illusdataName][j] and illusData[illusdataName][j] ~= '' then
Line 16: Line 19:
end
end
end
end
-- Emuilated this from NationLister and hoping it will just work with the table formatting stripped...
local returnString = 'Illustrations: '
local returnString = 'Illustrations: '
returnString = returnString .. tconcat(Illustrations, ' , ')
returnString = returnString .. tconcat(Illustrations, ' , ')

Revision as of 05:58, 8 December 2025

Documentation for this module may be created at Module:Illustration/doc

-- This is meant to be a way to reference and use the illustrations in the game easily on the wiki and inside other templates.
-- No idea what I'm doing really, and need a break, so just leaving whatever this is here for now.

local p = {}

local illusData = mw.loadData('Module:Illustration/data')

-- Currently just trying to get this to output all entries for a key into a readable string, to test the basics work.
function p.Illusnametest (frame)
	local illusdataName = frame.args[1]
	if illusdataName[illusData] then
		-- Am just infering that "j" counts entries for a key (no idea about correct syntax here really).
		local Illustrations = {}
		for j = 0, 5 do
			-- Am assuming tinsert is just an array for passing on data
			local illusFile = {}
			if illusData[illusdataName][j] and illusData[illusdataName][j] ~= '' then
				tinsert(Illustrations,illusData[illusFile][j])
			end
		end
		-- Emuilated this from NationLister and hoping it will just work with the table formatting stripped...
		local returnString = 'Illustrations: '
		returnString = returnString .. tconcat(Illustrations, ' , ')
		returnString = returnString .. 'Did this work?'
	end
end

return p