Open main menu
Home
Random
Nearby
Log in
Settings
About Kancolle Wiki
Disclaimers
Kancolle Wiki
Search
Changes
← Older edit
Newer edit →
Module:Calc
(view source)
Revision as of 05:42, 14 March 2018
178 bytes added
,
6 years ago
hue
Line 160:
Line 160:
return args.format == "table" and ("|" .. arg .. "\n") or arg
return args.format == "table" and ("|" .. arg .. "\n") or arg
end
end
+
+
local env = {}
function interpret_setter(s)
function interpret_setter(s)
Line 165:
Line 167:
local k = kv[1]
local k = kv[1]
local v = kv[2]
local v = kv[2]
−
if k and v then
+
local c = kv[3]
+
if
k and v and c then
+
env[c] = env[c] or require("Module:" .. c)
+
env[k] = env[c](v)
+
return true
+
elseif
k and v then
if k == "_equipment" then
if k == "_equipment" then
local equipment = {}
local equipment = {}
Line 184:
Line 191:
end
end
else
else
−
if v ~= "nil" then
+
if v ~= "nil"
and ship
then
ship[k] = tonumber(v)
ship[k] = tonumber(v)
+
else
+
env[k] = v
end
end
end
end
Line 239:
Line 248:
return format_arg(format_value(string.sub(arg, 3), target, ship))
return format_arg(format_value(string.sub(arg, 3), target, ship))
elseif prefix2 == "?#" then
elseif prefix2 == "?#" then
−
return frame:preprocess(format{
'{{${template}|${ship}}}', template =
string.sub(arg, 3),
ship
=
ship:name('/')
})
+
return frame:preprocess(format{string.sub(arg, 3),
this
=
env[this] or ""
})
else
else
return format_arg(format_value(string.sub(arg, 2), ship, target))
return format_arg(format_value(string.sub(arg, 2), ship, target))
がか
cssedit, gkautomate
6,941
edits