From 0775914a1c0ff81e40caa39f3aed193711f425b4 Mon Sep 17 00:00:00 2001 From: Jeremy Smitherman Date: Mon, 24 Dec 2018 17:11:04 -0600 Subject: [PATCH] Fixed random list, Fixed MEssage for all --- hoggit.lua | 3 +-- lib/group_commands.lua | 6 +++--- lib/utils.lua | 5 +++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/hoggit.lua b/hoggit.lua index 23e1a67..7833ed9 100644 --- a/hoggit.lua +++ b/hoggit.lua @@ -1,6 +1,5 @@ -trigger.action.outText(HOGGIT.script_base, 25) -trigger.action.outText(HOGGIT.log_base, 25) dofile(HOGGIT.script_base..[[\HOGGIT\lib\error_handling.lua]]) dofile(HOGGIT.script_base..[[\HOGGIT\lib\logging.lua]]) dofile(HOGGIT.script_base..[[\HOGGIT\lib\utils.lua]]) dofile(HOGGIT.script_base..[[\HOGGIT\lib\spawner.lua]]) +dofile(HOGGIT.script_base..[[\HOGGIT\lib\group_commands.lua]]) diff --git a/lib/group_commands.lua b/lib/group_commands.lua index 58efd09..6095aed 100644 --- a/lib/group_commands.lua +++ b/lib/group_commands.lua @@ -12,7 +12,7 @@ HOGGIT.GroupCommand = function(group, text, parent, handler) end end HOGGIT.GroupMenuAdded={} -GroupMenu = function( groupId, text, parent ) +HOGGIT.GroupMenu = function( groupId, text, parent ) if HOGGIT.GroupMenuAdded[tostring(groupId)] == nil then log("No commands from groupId " .. groupId .. " yet. Initializing menu state") HOGGIT.GroupMenuAdded[tostring(groupId)] = {} @@ -24,13 +24,13 @@ GroupMenu = function( groupId, text, parent ) return HOGGIT.GroupMenuAdded[tostring(groupId)][text] end -MessageToGroup = function(groupId, text, displayTime, clear) +HOGGIT.MessageToGroup = function(groupId, text, displayTime, clear) if not displayTime then displayTime = 10 end if clear == nil then clear = false end trigger.action.outTextForGroup( groupId, text, displayTime, clear) end -MessageToAll = function( text, displayTime ) +HOGGIT.MessageToAll = function( text, displayTime ) if not displayTime then displayTime = 10 end trigger.action.outText( text, displayTime ) end diff --git a/lib/utils.lua b/lib/utils.lua index bb19593..06d53de 100644 --- a/lib/utils.lua +++ b/lib/utils.lua @@ -1,3 +1,8 @@ +HOGGIT.randomInList = function(list) + local idx = math.random(1, #list) + return list[idx] + end + HOGGIT.filterTable = function(t, filter) local out = {} for k,v in pairs(t) do