From 89a6c19bdf30e15caf7cee91fff7e0dc9387c6f2 Mon Sep 17 00:00:00 2001 From: Kan18 <24967425+Kan18@users.noreply.github.com> Date: Thu, 18 Jul 2019 16:43:56 -0400 Subject: [PATCH] Fix swshop breaking with other websockets w.lua does not like websockets not opened with w.lua. this fixes that. this should fix not being able to use cloudcatcher/chatbox and operate the shop at the same time. --- swshop/w.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/swshop/w.lua b/swshop/w.lua index d157992..9b25fe7 100644 --- a/swshop/w.lua +++ b/swshop/w.lua @@ -71,14 +71,14 @@ function init(jua) jua = jua if async then jua.on("websocket_success", function(event, url, handle) - local id = findID(url) + local success, id = pcall(findID,url) if id and callbackRegistry[id] and callbackRegistry[id].success then callbackRegistry[id].success(id, handle) end end) jua.on("websocket_failure", function(event, url) - local id = findID(url) + local success, id = pcall(findID,url) if id and callbackRegistry[id] and callbackRegistry[id].failure then callbackRegistry[id].failure(id) end @@ -86,14 +86,14 @@ function init(jua) end) jua.on("websocket_message", function(event, url, data) - local id = findID(url) + local success, id = pcall(findID,url) if id and callbackRegistry[id] and callbackRegistry[id].message then callbackRegistry[id].message(id, data) end end) jua.on("websocket_closed", function(event, url) - local id = findID(url) + local success, id = pcall(findID,url) if id and callbackRegistry[id] and callbackRegistry[id].closed then callbackRegistry[id].closed(id) end @@ -132,4 +132,4 @@ end return { open = open, init = init -} \ No newline at end of file +} -- 2.49.1