From 846862e1e703be347136f5e3fe81e4c958cb8635 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 18 Mar 2021 16:23:47 +0100 Subject: mod_c2s: Improve code style We don't use the quoted table indexing style that often, it's not needed here and it's enough to check for falsyness rather than `nil`. --- plugins/mod_c2s.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index f3259ed2..57b7b0f7 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -226,11 +226,15 @@ module:hook_global("user-password-changed", function(event) end, 200); function runner_callbacks:ready() - if self.data["conn"] ~= nil then self.data.conn:resume(); end + if self.data.conn then + self.data.conn:resume(); + end end function runner_callbacks:waiting() - if self.data["conn"] ~= nil then self.data.conn:pause(); end + if self.data.conn then + self.data.conn:pause(); + end end function runner_callbacks:error(err) -- cgit v1.2.3