summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2015-02-12 05:49:30 +0100
committerWuzzy <almikes@aol.com>2015-02-12 05:49:30 +0100
commit1fb539e7d83ba57b737737f4cee6b863886577e4 (patch)
tree20a7bcfc87fd869266e2b72da78066d2bcd419ce /init.lua
parent197fc56145f81b36aad650e7b71fe5b03e05f66b (diff)
Minor refactoring
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/init.lua b/init.lua
index 5fda612..06681dc 100644
--- a/init.lua
+++ b/init.lua
@@ -114,15 +114,17 @@ function hb.register_hudbar(identifier, text_color, label, textures, default_sta
state.text = text
state.barlength = hb.value_to_barlength(start_value, start_max)
+ local main_error_text =
+ "[hudbars] Bad initial values of HUD bar identifier “"..tostring(identifier).."” for player "..name..". "
if start_max < start_value then
- minetest.log("error", "[hudbars] Bad initial values of HUD bar identifier “"..tostring(identifier).."” for player "..name..": start_max ("..start_max..") is smaller than start_value ("..start_value..")!")
+ minetest.log("error", main_error_text.."start_max ("..start_max..") is smaller than start_value ("..start_value..")!")
end
if start_max < 0 then
- minetest.log("error", "[hudbars] Bad initial values of HUD bar identifier “"..tostring(identifier).."” for player "..name..": start_max ("..start_max..") is smaller than 0!")
+ minetest.log("error", main_error_text.."start_max ("..start_max..") is smaller than 0!")
end
if start_value < 0 then
- minetest.log("error", "[hudbars] Bad initial values of HUD bar identifier “"..tostring(identifier).."” for player "..name..": start_value ("..start_value..") is smaller than 0!")
+ minetest.log("error", main_error_text.."start_value ("..start_value..") is smaller than 0!")
end
hb.hudtables[identifier].hudids[name] = ids
@@ -170,14 +172,16 @@ function hb.change_hudbar(player, identifier, new_value, new_max_value)
new_max_value = hudtable.hudstate[name].max
end
+ local main_error_text =
+ "[hudbars] Bad call to hb.change_hudbar, identifier: “"..tostring(identifier).."”, player name: “"..name.."”. "
if new_max_value < new_value then
- minetest.log("error", "[hudbars] Bad call to hb.change_hudbar, identifier: “"..tostring(identifier).."”, player name: “"..name.."”. new_max_value ("..new_max_value..") is smaller than new_value ("..new_value..")!")
+ minetest.log("error", main_error_text.."new_max_value ("..new_max_value..") is smaller than new_value ("..new_value..")!")
end
if new_max_value < 0 then
- minetest.log("error", "[hudbars] Bad call to hb.change_hudbar, identifier: “"..tostring(identifier).."”, player name: “"..name.."”. new_max_value ("..new_max_value..") is smaller than 0!")
+ minetest.log("error", main_error_text.."new_max_value ("..new_max_value..") is smaller than 0!")
end
if new_value < 0 then
- minetest.log("error", "[hudbars] Bad call to hb.change_hudbar, identifier: “"..tostring(identifier).."”, player name: “"..name.."”. new_value ("..new_value..") is smaller than 0!")
+ minetest.log("error", main_error_text.."new_value ("..new_value..") is smaller than 0!")
end
if hudtable.hudstate[name].hidden == false then