mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-12-23 22:22:23 +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 str:sub(#str) == "%" then
|
||||
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
|
||||
end
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user