Some optimization.
F16Gaming [05-23-12 - 17:52]
diff --git a/AuthManager.lua b/AuthManager.lua
index b19d0b3..37931c6 100644
--- a/AuthManager.lua
+++ b/AuthManager.lua
@@ -17,6 +17,11 @@
* along with Command. If not, see <http://www.gnu.org/licenses/>.
--]]
+-- Upvalues
+local tostring = tostring
+local tonumber = tonumber
+local math = math
+
local C = Command
C.AuthManager = {
diff --git a/ChatManager.lua b/ChatManager.lua
index d5aa1ec..740bf74 100644
--- a/ChatManager.lua
+++ b/ChatManager.lua
@@ -173,9 +173,11 @@ end
--- Handle a chat message.
-- @param msg The message to handle.
-- @param sender Player object of the player who sent the message.
--- @param channel Channel the message was sent from.
+-- @param channel The channel to which HandleMessage will send the result.
-- @param target Player or channel index.
+-- @param sourceChannel The source channel that the message was sent from.
-- @param isBN True if battle.net message, false or nil otherwise.
+-- @param pID Player ID (for battle.net messages, this is nil when isBN is false or nil).
--
function CM:HandleMessage(msg, sender, channel, target, sourceChannel, isBN, pID)
isBN = isBN or false
@@ -223,6 +225,10 @@ function CM:HandleMessage(msg, sender, channel, target, sourceChannel, isBN, pID
end
end
elseif result == "RAW_TABLE_OUTPUT" then
+ if type(arg) ~= "table" then
+ error("Received RAW_TABLE_OUTPUT request, but arg was of type '" .. type(arg) .. "', expected 'table', aborting...")
+ return
+ end
for _,v in ipairs(arg) do
self:SendMessage(tostring(v), channel, target, isBN)
end