From 9ecc0baa134d2810fef66e1caa47967f34f9f4fa Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 5 Dec 2026 07:01:06 +0300 Subject: [PATCH 1/2] Fix error --- lua/wire/client/customspawnmenu.lua | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lua/wire/client/customspawnmenu.lua b/lua/wire/client/customspawnmenu.lua index 9d025a21ad..a3575e552b 100644 --- a/lua/wire/client/customspawnmenu.lua +++ b/lua/wire/client/customspawnmenu.lua @@ -26,18 +26,20 @@ local function expandall( bool, nodes ) end end -local function expandbycookie( nodes ) - for i=1,#nodes do - local b = cookie.GetNumber( nodes[i].WireCookieText ) +local function expandbycookie(nodes) + for _, node in ipairs(nodes) do + if node.WireCookieText then + local b = cookie.GetNumber(node.WireCookieText) - if b and b == 1 then - nodes[i]:SetExpanded( b and b == 1 ) + if b == 1 then + node:SetExpanded(true) - if nodes[i].ChildNodes then - expandbycookie( nodes[i].ChildNodes:GetChildren() ) + if node.ChildNodes then + expandbycookie(node.ChildNodes:GetChildren()) + end + else + node:SetExpanded(false) end - else - nodes[i]:SetExpanded( false ) end end end From 36ce14f3f6893dffda2df70555e42482eebb1543 Mon Sep 17 00:00:00 2001 From: Astralcircle <142503363+Astralcircle@users.noreply.github.com> Date: Sat, 5 Dec 2026 07:05:32 +0300 Subject: [PATCH 2/2] Fix other issue also --- lua/wire/client/customspawnmenu.lua | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lua/wire/client/customspawnmenu.lua b/lua/wire/client/customspawnmenu.lua index a3575e552b..651c2d3c12 100644 --- a/lua/wire/client/customspawnmenu.lua +++ b/lua/wire/client/customspawnmenu.lua @@ -29,17 +29,11 @@ end local function expandbycookie(nodes) for _, node in ipairs(nodes) do if node.WireCookieText then - local b = cookie.GetNumber(node.WireCookieText) - - if b == 1 then - node:SetExpanded(true) + node:SetExpanded(cookie.GetNumber(node.WireCookieText) == 1) + end - if node.ChildNodes then - expandbycookie(node.ChildNodes:GetChildren()) - end - else - node:SetExpanded(false) - end + if node.ChildNodes then + expandbycookie(node.ChildNodes:GetChildren()) end end end