mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-26 17:12:59 +00:00
wea.parse.chance: use not
This commit is contained in:
parent
4ec04c03b3
commit
040d7fbfde
1 changed files with 1 additions and 1 deletions
|
@ -6,7 +6,7 @@ function worldeditadditions.parse.chance(str)
|
||||||
if tonumber(str) ~= nil then return tonumber(str) end
|
if tonumber(str) ~= nil then return tonumber(str) end
|
||||||
if str:sub(#str) == "%" then
|
if str:sub(#str) == "%" then
|
||||||
local result = tonumber(str:sub(1, #str-1))
|
local result = tonumber(str:sub(1, #str-1))
|
||||||
if result == nil then return nil end
|
if not result then return nil end
|
||||||
return 1 / (result / 100) -- Convert percentage to 1-in-N chance
|
return 1 / (result / 100) -- Convert percentage to 1-in-N chance
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue