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