summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2015-02-09 22:45:08 +0100
committerWuzzy <almikes@aol.com>2015-02-09 22:45:08 +0100
commit55dc460d42458f7543e552bb18a55e3455654e70 (patch)
tree219afec47547624a65d77e9114379d0ca53e3d3e
parent7d509adf5e22259167552875d2cf060b6be01218 (diff)
Use identifier instead of table in API functions
-rw-r--r--init.lua13
1 files changed, 10 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index 2491d99..e63956f 100644
--- a/init.lua
+++ b/init.lua
@@ -61,6 +61,10 @@ function hud.value_to_barlength(value, max)
end
end
+function hud.get_hudtable(identifier)
+ return hud.hudtables[identifier]
+end
+
function hud.register_hudbar(identifier, text_color, label, textures, default_start_value, default_start_max, start_hide, format_string)
local hudtable = {}
local pos, offset
@@ -147,8 +151,9 @@ function hud.register_hudbar(identifier, text_color, label, textures, default_st
hud.hudtables[identifier] = hudtable
end
-function hud.change_hudbar(player, hudtable, new_value, new_max_value)
+function hud.change_hudbar(player, identifier, new_value, new_max_value)
local name = player:get_player_name()
+ local hudtable = hud.get_hudtable(identifier)
hudtable.hudstate[name].value = new_value
hudtable.hudstate[name].max = new_max_value
if hudtable.hudstate[name].hidden == false then
@@ -164,8 +169,9 @@ function hud.change_hudbar(player, hudtable, new_value, new_max_value)
end
end
-function hud.hide_hudbar(player, hudtable)
+function hud.hide_hudbar(player, identifier)
local name = player:get_player_name()
+ local hudtable = hud.get_hudtable(identifier)
if(hudtable.hudstate[name].hidden == false) then
player:hud_change(hudtable.hudids[name].icon, "scale", {x=0,y=0})
player:hud_change(hudtable.hudids[name].bg, "scale", {x=0,y=0})
@@ -175,8 +181,9 @@ function hud.hide_hudbar(player, hudtable)
end
end
-function hud.unhide_hudbar(player, hudtable)
+function hud.unhide_hudbar(player, identifier)
local name = player:get_player_name()
+ local hudtable = hud.get_hudtable(identifier)
if(hudtable.hudstate[name].hidden) then
local name = player:get_player_name()
local value = hudtable.hudstate[name].value