1
0
Fork
You've already forked llecs
0
simple entity-component-system implementation for lua
Lua 100%
2026年01月04日 11:35:45 +00:00
LICENSE add MIT license because for some reason i hadn't done that already 2026年01月04日 11:35:45 +00:00
llecs.lua replace table.insert/ipairs in system member lists with a simpler set-inspired thing . unsure why i wasn't doing this before 2025年12月01日 09:45:09 +00:00
README.md initial commit 2025年11月24日 16:46:28 +00:00

llecs

a framework-agnostic small and simple entity-component-system implementation for lua

(example below uses love2d)

local ecs = require 'llecs'
ecs:filter('position', 'draw_rect')
function ecs.draw(position)
	love.graphics.rectangle('fill', position.x - 4, position.y - 4, 8, 8)
end
ecs:filter('position', 'velocity')
function ecs.update(dt, position, velocity)
	position.x = position.x + dt * velocity.x
	position.y = position.y + dt * velocity.y
end
love.draw = ecs.draw
love.update = ecs.update
function love.load()
	ecs:new {
		position = { x = 0, y = 0 },
		velocity = { x = 0, y = 0 },
		draw_rect = true,
	}
end