v50 Steam/Premium information for editors
- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.
Difference between revisions of "Module:MakeParserFunctions"
Jump to navigation
Jump to search
(create) |
(iterate explicitly, pairs(frame.args) doesn't work) |
||
Line 4: | Line 4: | ||
if type(v) == 'function' then | if type(v) == 'function' then | ||
out[k] = function(frame) | out[k] = function(frame) | ||
− | return v(unpack( | + | local args = {} |
+ | local i = 1 | ||
+ | while frame.args[i] do | ||
+ | args[i] = frame.args[i] | ||
+ | i = i + 1 | ||
+ | end | ||
+ | return v(unpack(args)) | ||
end | end | ||
end | end |
Latest revision as of 06:46, 26 November 2022
This module takes a table of functions that take string parameters and returns a table of functions that takes "frame" parameters and passes through their "args" to the original functions as positional arguments.
return function(env)
local out = {}
for k, v in pairs(env) do
if type(v) == 'function' then
out[k] = function(frame)
local args = {}
local i = 1
while frame.args[i] do
args[i] = frame.args[i]
i = i + 1
end
return v(unpack(args))
end
end
end
return out
end