Module:Arguments: திருத்தங்களுக்கு இடையிலான வேறுபாடு
உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
create argument-processing module |
return a table rather than a function, improve the comments |
||
வரிசை 1:
-- This module provides easy processing of arguments passed to Scribunto from #invoke.
-- It is intended for use by other Lua modules, and should not be called from #invoke directly.
local arguments = {}
local function getArguments(frame, options)▼
options = type(options) == 'table' and options or {}
-- Get the arguments from the frame object if available. If the frame object is not available, we are being called
-- from another Lua module or from the debug console, so assume arguments are passed directly in.
local fargs, pargs
if frame == mw.getCurrentFrame() then
வரி 31 ⟶ 36:
end
-- Use a user-generated functions to tidy the values if specified.
local valueFunc = options.valueFunc
if valueFunc then
வரி 54 ⟶ 60:
end
-- Set the order of precedence of frame args and parent args.
local firstArgs, secondArgs = fargs, pargs
if options.parentFirst then
வரி 59 ⟶ 66:
end
-- Define metatable behaviour.
metatable.__index = function (t, key)
local val = metaArgs[key]
வரி 99 ⟶ 107:
end
return
| |||