Skip to content

Commit

Permalink
Fixing function conflicting with global variable of same name (in con…
Browse files Browse the repository at this point in the history
…fig.lua) (#675)

The variable of the same name is found in config.lua, which conflicts with the global function and causes problems after using "/reload" command.
  • Loading branch information
dudantas committed Dec 8, 2022
1 parent 7a9cfc1 commit 095cea1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions data-canary/scripts/lib/register_monster_type.lua
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ registerMonsterType.events = function(mtype, mask)
end
end

function sortLootByChance(loot)
function SortLootByChance(loot)
if not configManager.getBoolean(configKeys.SORT_LOOT_BY_CHANCE) then
return
end
Expand All @@ -290,7 +290,7 @@ end

registerMonsterType.loot = function(mtype, mask)
if type(mask.loot) == "table" then
sortLootByChance(mask.loot)
SortLootByChance(mask.loot)
local lootError = false
for _, loot in pairs(mask.loot) do
local parent = Loot()
Expand Down Expand Up @@ -352,7 +352,7 @@ registerMonsterType.loot = function(mtype, mask)
parent:setUnique(loot.unique)
end
if loot.child then
sortLootByChance(loot.child)
SortLootByChance(loot.child)
for _, children in pairs(loot.child) do
local child = Loot()
if children.name then
Expand Down
6 changes: 3 additions & 3 deletions data-otservbr-global/scripts/lib/register_monster_type.lua
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ registerMonsterType.events = function(mtype, mask)
end
end

function sortLootByChance(loot)
function SortLootByChance(loot)
if not configManager.getBoolean(configKeys.SORT_LOOT_BY_CHANCE) then
return
end
Expand All @@ -291,7 +291,7 @@ end

registerMonsterType.loot = function(mtype, mask)
if type(mask.loot) == "table" then
sortLootByChance(mask.loot)
SortLootByChance(mask.loot)
local lootError = false
for _, loot in pairs(mask.loot) do
local parent = Loot()
Expand Down Expand Up @@ -353,7 +353,7 @@ registerMonsterType.loot = function(mtype, mask)
parent:setUnique(loot.unique)
end
if loot.child then
sortLootByChance(loot.child)
SortLootByChance(loot.child)
for _, children in pairs(loot.child) do
local child = Loot()
if children.name then
Expand Down

0 comments on commit 095cea1

Please sign in to comment.