From 18ce3029371941b4684e5fdea8b9d275957a6114 Mon Sep 17 00:00:00 2001 From: the lemons Date: Mon, 14 Nov 2022 19:32:14 -0600 Subject: properly localize all functions --- main.lua | 4 ++-- server_logic.lua | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/main.lua b/main.lua index 18fe919..03f4431 100644 --- a/main.lua +++ b/main.lua @@ -16,7 +16,7 @@ local function reject(stream, code, reason) stream:write_chunk(reason, true) end -function onstream(server, stream) +local function onstream(server, stream) print("stream you.") local head = stream:get_headers() @@ -37,7 +37,7 @@ function onstream(server, stream) logic.onsocket(ws,room) local ws_open = true - function close() + local function close() logic.onclose(ws) if ws_open then ws:close() end ws_open = false diff --git a/server_logic.lua b/server_logic.lua index 4c6c229..02f6718 100644 --- a/server_logic.lua +++ b/server_logic.lua @@ -7,7 +7,7 @@ local ping_interval = 6 M.ping_interval = ping_interval local debug_mode = true -function debug(...) +local function debug(...) if debug_mode then print(...) end end @@ -76,7 +76,7 @@ local client_metatable = { } } -function try_room(r) +local function try_room(r) if activerooms[r] then return activerooms[r] end local res = { users = {}, @@ -125,4 +125,4 @@ function M.ping(s) client:ping() end -return M \ No newline at end of file +return M -- cgit v1.2.3