mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-08-13 00:45:11 +09:00
Narrow the gui player lookups
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -61,7 +61,7 @@ local GuiData = {
|
||||
--- @field element_data table<uint, table<uint, any>>
|
||||
--- @field player_data table<uint, any>
|
||||
--- @field force_data table<uint, any>
|
||||
--- @field global_data table
|
||||
--- @field global_data table
|
||||
--- @field [DataKey] any
|
||||
-- This class has no prototype methods
|
||||
-- Same as raw but __index ensures the values exist
|
||||
@@ -99,7 +99,7 @@ function GuiData._metatable.__index(self, key)
|
||||
local data = self._raw.player_data
|
||||
return data and data[key.index]
|
||||
elseif object_name == "LuaForce" then
|
||||
--- @cast key LuaForce
|
||||
--- @cast key LuaForce
|
||||
local data = self._raw.force_data
|
||||
return data and data[key.index]
|
||||
else
|
||||
@@ -172,7 +172,7 @@ local function on_object_destroyed(event)
|
||||
for _, scope in pairs(registered_scopes) do
|
||||
local data = scope._raw.element_data
|
||||
local player_elements = data and data[player_index]
|
||||
if player_elements then
|
||||
if data and player_elements then
|
||||
player_elements[element_index] = nil
|
||||
if not next(player_elements) then
|
||||
data[player_index] = nil
|
||||
|
||||
Reference in New Issue
Block a user