Clear the last of the nil checks

Guards now cover the statements that follow them, and a couple of reads
are restructured so the narrowing survives.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
bbassie
2026-08-07 15:31:43 +00:00
co-authored by Claude Opus 5
parent 76ecc37d3f
commit f5656025ee
9 changed files with 31 additions and 22 deletions
+7 -5
View File
@@ -14,7 +14,8 @@ end
]]
local ext, var
local ext --- @type table<string, any>
local var --- @type table<string, any>
local concat = table.concat
local External = {}
@@ -29,12 +30,13 @@ end
]]
function External.valid()
if storage.ext == nil then return false end
if ext == storage.ext and var == ext.var then
local stored = storage.ext
if stored == nil then return false end
if ext == stored and var == ext.var then
return var ~= nil
else
ext = storage.ext
var = ext.var
ext = stored
var = stored.var
return var ~= nil
end
end
@@ -34,7 +34,7 @@ for _, config_key in ipairs{ "always_protected_names", "always_protected_types",
end
-- Require roles if a permission is assigned in the config
local Roles
local Roles --- @type table<string, any>
if config.ignore_permission then
Roles = require("modules.exp_legacy.expcore.roles") --- @dep expcore.roles
end
@@ -4,7 +4,7 @@ local Gui = require("modules/exp_gui")
local Event = require("modules/exp_legacy/utils/event") --- @dep utils.event
----- Locals -----
local follow_label -- Gui constructor
local follow_label --- @type ExpElement Gui constructor
local following = {}
local spectating = {}
local Public = {}
+2 -2
View File
@@ -673,7 +673,7 @@ warp_list_container = Gui.define("warp_list_container")
-- Draw the scroll table for the warps
local scroll_table = Gui.elements.scroll_table(container, 250, 3, "scroll")
-- Set the scroll panel to always show the scrollbar (not doing this will result in a changing gui size)
scroll_table.parent.vertical_scroll_policy = "always"
assert(scroll_table.parent).vertical_scroll_policy = "always"
-- Change the style of the scroll table
local scroll_table_style = scroll_table.style
@@ -874,7 +874,7 @@ local function role_update_event(event)
-- Check if user has permission to add warps
local allow_add_warp = check_player_permissions(player, "allow_add_warp")
-- Update container size depending on whether the player is allowed to add warps
frame.parent.style.width = allow_add_warp and 268 or 220
assert(frame.parent).style.width = allow_add_warp and 268 or 220
-- Update the warps, in case the user can now edit them
local scroll_table = frame.scroll.table