From be54be4e7ed60c6ecf046c72efe67c5b6bea8a57 Mon Sep 17 00:00:00 2001 From: Konstantin Burkalev Date: Tue, 22 May 2018 13:01:27 +0300 Subject: [PATCH] Small refactoring --- src/wiola/wiola.lua | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/src/wiola/wiola.lua b/src/wiola/wiola.lua index c7ed1d0..985bfe8 100644 --- a/src/wiola/wiola.lua +++ b/src/wiola/wiola.lua @@ -7,7 +7,7 @@ --local getdump = require("debug.vardump").getdump local _M = { - _VERSION = '0.9.0', + _VERSION = '0.9.1', } _M.__index = _M @@ -18,27 +18,6 @@ setmetatable(_M, { end }) ---- ---- Return index of obj in array t ---- ---- @param t table array table ---- @param obj any object to search ---- @return index of obj or -1 if not found ---------------------------------------------------- -local arrayIndexOf = function(t, obj) - if type(t) == 'table' then - for i = 1, #t do - if t[i] == obj then - return i - end - end - - return -1 - else - error("table.indexOf expects table for first argument, " .. type(t) .. " given") - end -end - local wamp_features = { agent = "wiola/Lua v" .. _M._VERSION, roles = { @@ -619,7 +598,7 @@ function _M:receiveData(regId, data) else local realm = dataObj[2] - if arrayIndexOf(config.realms, realm) < 0 and config.realms[1] ~= "*" then + if not has(config.realms, realm) and config.realms[1] ~= "*" then -- WAMP SPEC: [ABORT, Details|dict, Reason|uri] self:_putData(session, { WAMP_MSG_SPEC.ABORT,