mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-11-23 23:33:12 +09:00
lint
This commit is contained in:
1 parent
311d3a35d8
commit
466642d3da
1 file changed
+6
-1
@@ -4,6 +4,7 @@ Add a calculator to do quick calculation.
|
|||||||
|
|
||||||
local Gui = require("modules/exp_gui")
|
local Gui = require("modules/exp_gui")
|
||||||
local Roles = require("modules/exp_roles")
|
local Roles = require("modules/exp_roles")
|
||||||
|
local format_number = require("util").format_number
|
||||||
|
|
||||||
--- @class ExpGui_Calculator.elements
|
--- @class ExpGui_Calculator.elements
|
||||||
local Elements = {}
|
local Elements = {}
|
||||||
@@ -149,6 +150,7 @@ function Elements.parse(expression)
|
|||||||
|
|
||||||
if character == "|" then
|
if character == "|" then
|
||||||
cursor = cursor + 1
|
cursor = cursor + 1
|
||||||
|
---@diagnostic disable-next-line: need-check-nil
|
||||||
local value = parse_expr(1)
|
local value = parse_expr(1)
|
||||||
skip_space()
|
skip_space()
|
||||||
|
|
||||||
@@ -161,6 +163,7 @@ function Elements.parse(expression)
|
|||||||
|
|
||||||
elseif character == "(" then
|
elseif character == "(" then
|
||||||
cursor = cursor + 1
|
cursor = cursor + 1
|
||||||
|
---@diagnostic disable-next-line: need-check-nil
|
||||||
local value = parse_expr(1)
|
local value = parse_expr(1)
|
||||||
skip_space()
|
skip_space()
|
||||||
|
|
||||||
@@ -192,6 +195,7 @@ function Elements.parse(expression)
|
|||||||
end
|
end
|
||||||
|
|
||||||
cursor = cursor + 1
|
cursor = cursor + 1
|
||||||
|
---@diagnostic disable-next-line: need-check-nil
|
||||||
local argument = parse_expr(1)
|
local argument = parse_expr(1)
|
||||||
skip_space()
|
skip_space()
|
||||||
|
|
||||||
@@ -306,6 +310,7 @@ function Elements.parse(expression)
|
|||||||
end
|
end
|
||||||
|
|
||||||
cursor = cursor + 1
|
cursor = cursor + 1
|
||||||
|
---@diagnostic disable-next-line: need-check-nil
|
||||||
lhs = entry[2](lhs, parse_expr(entry[1] + 1))
|
lhs = entry[2](lhs, parse_expr(entry[1] + 1))
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -323,7 +328,7 @@ function Elements.parse(expression)
|
|||||||
return value
|
return value
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return ok and result or (type(result) == "table" and result or {"exp-gui_calculator.error", tostring(result)})
|
return ok and format_number(result, false) or (type(result) == "table" and result or {"exp-gui_calculator.error", tostring(result)})
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Value change
|
--- Value change
|
||||||
|
|||||||
Reference in new issue
Block a user