Remove upvalues

This commit is contained in:
Ukendio 2024-11-23 20:50:15 +01:00
parent 727cc93a7d
commit 46147cc9f9

View file

@ -330,14 +330,7 @@ local function hash(arr: { number }): string
return table.concat(arr, "_")
end
local world_get: (world: World, entityId: i53, a: i53, b: i53?, c: i53?, d: i53?, e: i53?) -> ...any
do
-- Keeping the function as small as possible to enable inlining
local records: { ArchetypeRecord }
local columns: { { any } }
local row: number
local function fetch(id): any
local function fetch(id, records: { ArchetypeRecord }, columns: { Column }, row: number): any
local tr = records[id]
if not tr then
@ -347,7 +340,7 @@ do
return columns[tr.column][row]
end
function world_get(world: World, entity: i53, a: i53, b: i53?, c: i53?, d: i53?, e: i53?): ...any
local function world_get(world: World, entity: i53, a: i53, b: i53?, c: i53?, d: i53?, e: i53?): ...any
local record = entity_index_try_get_fast(world.entity_index, entity)
if not record then
return nil
@ -358,25 +351,24 @@ do
return nil
end
records = archetype.records
columns = archetype.columns
row = record.row
local records = archetype.records
local columns = archetype.columns
local row = record.row
local va = fetch(a)
local va = fetch(a, records, columns, row)
if not b then
return va
elseif not c then
return va, fetch(b)
return va, fetch(b, records, columns, row)
elseif not d then
return va, fetch(b), fetch(c)
return va, fetch(b, records, columns, row), fetch(c, records, columns, row)
elseif not e then
return va, fetch(b), fetch(c), fetch(d)
return va, fetch(b, records, columns, row), fetch(c, records, columns, row), fetch(d, records, columns, row)
else
error("args exceeded")
end
end
end
local function world_get_one_inline(world: World, entity: i53, id: i53): any
local record = entity_index_try_get_fast(world.entity_index, entity)