mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-23 23:53:44 +01:00
wea.parse.chance: use not
This commit is contained in:
parent
4ec04c03b3
commit
040d7fbfde
@ -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 New Issue
Block a user