mirror of
				https://github.com/Ukendio/jecs.git
				synced 2025-10-31 01:09:16 +00:00 
			
		
		
		
	lets go fast
This commit is contained in:
		
							parent
							
								
									bee330c9a5
								
							
						
					
					
						commit
						354f100dd1
					
				
					 1 changed files with 5 additions and 7 deletions
				
			
		
							
								
								
									
										12
									
								
								lib/init.lua
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								lib/init.lua
									
									
									
									
									
								
							|  | @ -598,6 +598,7 @@ end | |||
| 
 | ||||
| function World.observer(world: World, ...) | ||||
| 	local componentIds = {...} | ||||
| 	local idsCount = #componentIds | ||||
| 	local hooks = world.hooks | ||||
| 
 | ||||
| 	return { | ||||
|  | @ -633,19 +634,16 @@ function World.observer(world: World, ...) | |||
| 					matched = true | ||||
| 				end | ||||
| 
 | ||||
| 				local queryOutput = {} | ||||
| 				local length = 0 | ||||
| 
 | ||||
| 				local queryOutput = table.create(idsCount) | ||||
| 				local row = change.offset | ||||
| 				local archetype = change.archetype | ||||
| 				local columns = archetype.columns | ||||
| 				local archetypeRecords = archetype.records | ||||
| 				for _, id in componentIds do | ||||
| 					length += 1 | ||||
| 					queryOutput[length] = columns[archetypeRecords[id]][row] | ||||
| 				for index, id in componentIds do | ||||
| 					queryOutput[index] = columns[archetypeRecords[id]][row] | ||||
| 				end | ||||
| 
 | ||||
| 				return archetype.entities[row], unpack(queryOutput, 1, length) | ||||
| 				return archetype.entities[row], unpack(queryOutput, 1, idsCount) | ||||
| 			end | ||||
| 		end; | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue