Skip to content

Commit

Permalink
Add nil check for replace_with_item (#28)
Browse files Browse the repository at this point in the history
Needed because str:format in Lua5.1 will not interpret nil values, whereas LuaJIT will interpret them.
  • Loading branch information
fluxionary authored and SmallJoker committed Nov 26, 2019
1 parent 5bb5417 commit 6ee95f9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,13 @@ function minetest.do_item_eat(hp_change, replace_with_item, itemstack, player, p
end

local itemname = itemstack:get_name()
stamina.log("action", "%s eats %s for %s stamina, replace with %s",
if replace_with_item then
stamina.log("action", "%s eats %s for %s stamina, replace with %s",
player:get_player_name(), itemname, hp_change, replace_with_item)
else
stamina.log("action", "%s eats %s for %s stamina",
player:get_player_name(), itemname, hp_change)
end
minetest.sound_play("stamina_eat", {to_player = player:get_player_name(), gain = 0.7})

if hp_change > 0 then
Expand Down

0 comments on commit 6ee95f9

Please sign in to comment.