Editing Module:Infobox
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 368: | Line 368: | ||
local func_name = func.name |
local func_name = func.name |
||
local func_params = func.params |
local func_params = func.params |
||
local |
local func_fetched_params = {} |
||
local i = 1 |
|||
for _, func_param in ipairs(func_params) do |
|||
⚫ | |||
⚫ | |||
i = i + 1 |
|||
end |
end |
||
⚫ | |||
local function get_params(i) |
|||
if i == n_params then |
|||
⚫ | |||
else |
|||
return self:get_param(func_params[i], version), get_params(i + 1) |
|||
end |
|||
end |
|||
return func_name(get_params(1)) |
|||
else |
else |
||
table.insert(self.errors, 'Invalid param definition for '..param_name) |
table.insert(self.errors, 'Invalid param definition for '..param_name) |
||
Line 477: | Line 472: | ||
local subobject = { |
local subobject = { |
||
Infobox = self.infobox_name, -- Also store the current Infobox name |
Infobox = self.infobox_name, -- Also store the current Infobox name |
||
['Version anchor'] = |
['Version anchor'] = self.version_names[version], -- Store the version anchor |
||
} |
} |
||
for _, param_name in ipairs(self.param_names) do |
for _, param_name in ipairs(self.param_names) do |
||
Line 496: | Line 491: | ||
result = mw.smw.set(subobject) |
result = mw.smw.set(subobject) |
||
else |
else |
||
subobject['Version default'] = tostring(version == self.default_version) |
|||
result = mw.smw.subobject(subobject, subobject_name) |
result = mw.smw.subobject(subobject, subobject_name) |
||
mw.smw.set({['Version subobject']=tostring(mw.title.getCurrentTitle())..'#'..self.version_names[version]}) |
|||
end |
end |
||
if result ~= true then |
if result ~= true then |
||
Line 504: | Line 497: | ||
end |
end |
||
end |
end |
||
end |
|||
if self.versions > 1 then |
|||
mw.smw.set({['Default subobject']=tostring(mw.title.getCurrentTitle())..'#'..self.version_names[self.default_version]}) |
|||
end |
end |
||
end |
end |