lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Aug 2, 2019 at 12:14 AM Soni "They/Them" L. wrote:
On 2019-08-01 6:05 p.m., Egor Skriptunoff wrote:
> Could you provide an example to show benefits of traits?
> What kinds of tasks traits solve better than conventional
> 'objects-and-methods' approach?
>

Inventory may not be self-contained. Inventory could reference another
trait.

I recommend reading https://en.wikipedia.org/wiki/Entity_component_system


I'm aware of entity-component-system approach.
And this is my understanding of how it should be implemented in Lua:
https://stackoverflow.com/a/42660932/1847592
And I don't see how traits could help implementing it.
The best way to implement ECS is "don't use OOP at all".