Line 24: |
Line 24: |
| local shipCapabilities = {} | | local shipCapabilities = {} |
| local equipment = nil | | local equipment = nil |
| + | local filterArg = nil |
| | | |
| -- $('.calc-debug').show().appendTo('#mw-content-text') | | -- $('.calc-debug').show().appendTo('#mw-content-text') |
Line 399: |
Line 400: |
| elseif arg == "-" then | | elseif arg == "-" then |
| return format_arg("") | | return format_arg("") |
| + | elseif prefix == "~" then |
| + | filterArg = string.sub(arg, 2) |
| elseif prefix == "@" then | | elseif prefix == "@" then |
| local enumerator = string.sub(arg, 2) | | local enumerator = string.sub(arg, 2) |
Line 460: |
Line 463: |
| return frame:preprocess(format{string.sub(arg, 3), this = env[this] or ""}) | | return frame:preprocess(format{string.sub(arg, 3), this = env[this] or ""}) |
| else | | else |
− | if args.filter then | + | if filterArg then |
− | local kv = U.split(args.filter, " = ") | + | local kv = U.split(filterArg, "=") |
| if tostring(ship[kv[1]](ship)) == kv[2] then | | if tostring(ship[kv[1]](ship)) == kv[2] then |
| return format_arg(format_value(string.sub(arg, 2), ship, target)) | | return format_arg(format_value(string.sub(arg, 2), ship, target)) |
Line 561: |
Line 564: |
| Calc.format(nil, { | | Calc.format(nil, { |
| "@all_names", | | "@all_names", |
| + | "~hp_mod_married=0", |
| "!@", | | "!@", |
| "?link", | | "?link", |
− | filter = "hp_mod_married = 0"
| |
| }) | | }) |
| ) | | ) |
| end | | end |
| | | |
− | -- print(p.test()) | + | -- print(p.test2()) |
| | | |
| return Calc | | return Calc |