mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-27 17:43:53 +01:00
streamlined getsign
This commit is contained in:
parent
e5443bc3ce
commit
533519d318
@ -82,9 +82,12 @@ end
|
||||
-- @param src string|int Input string.
|
||||
-- @return string|int Returns the signed multiplier (1|-1).
|
||||
function worldeditadditions.getsign(src)
|
||||
if type(src) == "number" then return src < 0 and -1 or 1
|
||||
if type(src) == "number" then
|
||||
if src < 0 then return -1 else return 1 end
|
||||
elseif type(src) ~= "string" then return 1
|
||||
else return src:match('-') and -1 or 1 end
|
||||
else
|
||||
if src:match('-') then return -1 else return 1 end
|
||||
end
|
||||
end
|
||||
|
||||
--- Clamp a number to ensure it falls within a given range.
|
||||
|
Loading…
Reference in New Issue
Block a user