Line 150: |
Line 150: |
| local sequence = nil | | local sequence = nil |
| local sequence_position = nil | | local sequence_position = nil |
| + | |
| + | function format_arg(arg) |
| + | return args.format == "table" and ("|" .. arg .. "\n") or arg |
| + | end |
| | | |
| function interpret_arg(arg) | | function interpret_arg(arg) |
| local prefix = string.sub(arg, 1, 1) | | local prefix = string.sub(arg, 1, 1) |
| local prefix2 = string.sub(arg, 1, 2) | | local prefix2 = string.sub(arg, 1, 2) |
− | if prefix == "@" then | + | if arg == "" then |
| + | return |
| + | elseif arg == "-" then |
| + | return format_arg("") |
| + | elseif prefix == "@" then |
| local enumerator = string.sub(arg, 2) | | local enumerator = string.sub(arg, 2) |
| local enumerating_function = enumerating_functions[enumerator] | | local enumerating_function = enumerating_functions[enumerator] |
Line 233: |
Line 241: |
| local prefix2 = string.sub(arg, 1, 2) | | local prefix2 = string.sub(arg, 1, 2) |
| if prefix2 == "??" then | | if prefix2 == "??" then |
− | local key = string.sub(arg, 3) | + | return format_arg(format_value(string.sub(arg, 3), target, ship)) |
− | local value = format_value(key, target, ship)
| |
− | if args.format == "table" then
| |
− | return "|" .. value .. "\n"
| |
− | else
| |
− | return value
| |
− | end
| |
| elseif prefix2 == "?#" then | | elseif prefix2 == "?#" then |
− | local key = string.sub(arg, 3)
| + | return frame:preprocess(format{ '{{${template}|${ship}}}', template = string.sub(arg, 3), ship = ship:name('/') }) |
− | return frame:preprocess(format{ | |
− | '{{${template}|${ship}}}',
| |
− | template = key,
| |
− | ship = ship:name('/')
| |
− | })
| |
| else | | else |
− | local key = string.sub(arg, 2) | + | return format_arg(format_value(string.sub(arg, 2), ship, target)) |
− | local value = format_value(key, ship, target)
| |
− | if args.format == "table" then
| |
− | return "|" .. value .. "\n"
| |
− | else
| |
− | return value
| |
− | end
| |
| end | | end |
| else | | else |
− | return args.format == "table" and ("|" .. arg .. "\n") or arg | + | return format_arg(arg) |
| end | | end |
| end | | end |
Line 310: |
Line 301: |
| Calc.format(nil, { | | Calc.format(nil, { |
| format = "table", | | format = "table", |
− | "!Nagato/Kai Ni", | + | "!Nagato/Kai Ni: 41cm Triple Gun Mount Kai, 41cm Triple Gun Mount Kai, Type 13 Air Radar Kai", |
| "!_level ~ 99", | | "!_level ~ 99", |
| "!_accuracy ~ 10", | | "!_accuracy ~ 10", |
| "!_luck ~ nil", | | "!_luck ~ nil", |
| "!_morale ~ 25", | | "!_morale ~ 25", |
| + | "!_fit ~ 7", |
| "!cl0 ~ 56", | | "!cl0 ~ 56", |
| "!cl1 ~ 807", | | "!cl1 ~ 807", |