mirror of
				https://github.com/Ukendio/jecs.git
				synced 2025-10-31 17:20:32 +00:00 
			
		
		
		
	Remove upvalues
This commit is contained in:
		
							parent
							
								
									727cc93a7d
								
							
						
					
					
						commit
						46147cc9f9
					
				
					 1 changed files with 30 additions and 38 deletions
				
			
		
							
								
								
									
										26
									
								
								jecs.luau
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								jecs.luau
									
									
									
									
									
								
							|  | @ -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) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue