Skip to content

Commit 74e5693

Browse files
authored
Merge pull request #46 from BlackMATov/dev
Dev
2 parents c072842 + 8c59bdf commit 74e5693

15 files changed

Lines changed: 625 additions & 201 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: lua5.1
1+
name: lua5.1.5
22

33
on: [push, pull_request]
44

@@ -8,14 +8,15 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
lua_version: ["5.1"]
11+
lua_version: ["5.1.5"]
1212
operating_system: ["ubuntu-latest", "macos-latest", "windows-latest"]
1313
name: ${{matrix.operating_system}}-${{matrix.lua_version}}
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616
- uses: ilammy/msvc-dev-cmd@v1
1717
- uses: leafo/gh-actions-lua@v12
1818
with:
1919
luaVersion: ${{matrix.lua_version}}
2020
- run: |
21+
lua -v
2122
lua ./develop/all.lua
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: lua5.2
1+
name: lua5.2.4
22

33
on: [push, pull_request]
44

@@ -8,14 +8,15 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
lua_version: ["5.2"]
11+
lua_version: ["5.2.4"]
1212
operating_system: ["ubuntu-latest", "macos-latest", "windows-latest"]
1313
name: ${{matrix.operating_system}}-${{matrix.lua_version}}
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616
- uses: ilammy/msvc-dev-cmd@v1
1717
- uses: leafo/gh-actions-lua@v12
1818
with:
1919
luaVersion: ${{matrix.lua_version}}
2020
- run: |
21+
lua -v
2122
lua ./develop/all.lua
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: lua5.3
1+
name: lua5.3.6
22

33
on: [push, pull_request]
44

@@ -8,14 +8,15 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
lua_version: ["5.3"]
11+
lua_version: ["5.3.6"]
1212
operating_system: ["ubuntu-latest", "macos-latest", "windows-latest"]
1313
name: ${{matrix.operating_system}}-${{matrix.lua_version}}
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616
- uses: ilammy/msvc-dev-cmd@v1
1717
- uses: leafo/gh-actions-lua@v12
1818
with:
1919
luaVersion: ${{matrix.lua_version}}
2020
- run: |
21+
lua -v
2122
lua ./develop/all.lua
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: lua5.4
1+
name: lua5.4.8
22

33
on: [push, pull_request]
44

@@ -8,14 +8,15 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
lua_version: ["5.4"]
11+
lua_version: ["5.4.8"]
1212
operating_system: ["ubuntu-latest", "macos-latest", "windows-latest"]
1313
name: ${{matrix.operating_system}}-${{matrix.lua_version}}
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v6
1616
- uses: ilammy/msvc-dev-cmd@v1
1717
- uses: leafo/gh-actions-lua@v12
1818
with:
1919
luaVersion: ${{matrix.lua_version}}
2020
- run: |
21+
lua -v
2122
lua ./develop/all.lua

.github/workflows/lua5.5.0.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: lua5.5.0
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{matrix.operating_system}}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
lua_version: ["5.5.0"]
12+
operating_system: ["ubuntu-latest", "macos-latest", "windows-latest"]
13+
name: ${{matrix.operating_system}}-${{matrix.lua_version}}
14+
steps:
15+
- uses: actions/checkout@v6
16+
- uses: ilammy/msvc-dev-cmd@v1
17+
- uses: leafo/gh-actions-lua@v12
18+
with:
19+
luaVersion: ${{matrix.lua_version}}
20+
- run: |
21+
lua -v
22+
lua ./develop/all.lua

.github/workflows/luajit.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/luajit2.1.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: luajit2.1
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{matrix.operating_system}}
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
lua_version: ["luajit-2.1"]
12+
operating_system: ["ubuntu-latest", "macos-latest", "windows-latest"]
13+
name: ${{matrix.operating_system}}-${{matrix.lua_version}}
14+
steps:
15+
- uses: actions/checkout@v6
16+
- uses: ilammy/msvc-dev-cmd@v1
17+
- uses: leafo/gh-actions-lua@v12
18+
with:
19+
luaVersion: ${{matrix.lua_version}}
20+
- run: |
21+
lua -v
22+
lua ./develop/all.lua

README.md

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,35 @@
22

33
> Evolved ECS (Entity-Component-System) for Lua
44
5-
[![lua5.1][badge.lua5.1]][lua5.1]
6-
[![lua5.4][badge.lua5.4]][lua5.4]
7-
[![luajit][badge.luajit]][luajit]
5+
[![lua5.1.5][badge.lua5.1.5]][lua5.1.5]
6+
[![lua5.2.4][badge.lua5.2.4]][lua5.2.4]
7+
[![lua5.3.6][badge.lua5.3.6]][lua5.3.6]
8+
[![lua5.4.8][badge.lua5.4.8]][lua5.4.8]
9+
[![lua5.5.0][badge.lua5.5.0]][lua5.5.0]
10+
[![luajit2.1][badge.luajit2.1]][luajit2.1]
811
[![license][badge.license]][license]
912

10-
[badge.lua5.1]: https://img.shields.io/github/actions/workflow/status/BlackMATov/evolved.lua/.github/workflows/lua5.1.yml?label=Lua%205.1
11-
[badge.lua5.4]: https://img.shields.io/github/actions/workflow/status/BlackMATov/evolved.lua/.github/workflows/lua5.4.yml?label=Lua%205.4
12-
[badge.luajit]: https://img.shields.io/github/actions/workflow/status/BlackMATov/evolved.lua/.github/workflows/luajit.yml?label=LuaJIT
13+
[badge.lua5.1.5]: https://img.shields.io/github/actions/workflow/status/BlackMATov/evolved.lua/.github/workflows/lua5.1.5.yml?label=Lua%205.1
14+
[badge.lua5.2.4]: https://img.shields.io/github/actions/workflow/status/BlackMATov/evolved.lua/.github/workflows/lua5.2.4.yml?label=Lua%205.2
15+
[badge.lua5.3.6]: https://img.shields.io/github/actions/workflow/status/BlackMATov/evolved.lua/.github/workflows/lua5.3.6.yml?label=Lua%205.3
16+
[badge.lua5.4.8]: https://img.shields.io/github/actions/workflow/status/BlackMATov/evolved.lua/.github/workflows/lua5.4.8.yml?label=Lua%205.4
17+
[badge.lua5.5.0]: https://img.shields.io/github/actions/workflow/status/BlackMATov/evolved.lua/.github/workflows/lua5.5.0.yml?label=Lua%205.5
18+
[badge.luajit2.1]: https://img.shields.io/github/actions/workflow/status/BlackMATov/evolved.lua/.github/workflows/luajit2.1.yml?label=LuaJIT%202.1
1319
[badge.license]: https://img.shields.io/badge/license-MIT-blue
1420

15-
[lua5.1]: https://github.com/BlackMATov/evolved.lua/actions?query=workflow%3Alua5.1
16-
[lua5.4]: https://github.com/BlackMATov/evolved.lua/actions?query=workflow%3Alua5.4
17-
[luajit]: https://github.com/BlackMATov/evolved.lua/actions?query=workflow%3Aluajit
21+
[lua5.1.5]: https://github.com/BlackMATov/evolved.lua/actions?query=workflow%3Alua5.1.5
22+
[lua5.2.4]: https://github.com/BlackMATov/evolved.lua/actions?query=workflow%3Alua5.2.4
23+
[lua5.3.6]: https://github.com/BlackMATov/evolved.lua/actions?query=workflow%3Alua5.3.6
24+
[lua5.4.8]: https://github.com/BlackMATov/evolved.lua/actions?query=workflow%3Alua5.4.8
25+
[lua5.5.0]: https://github.com/BlackMATov/evolved.lua/actions?query=workflow%3Alua5.5.0
26+
[luajit2.1]: https://github.com/BlackMATov/evolved.lua/actions?query=workflow%3Aluajit2.1
1827
[license]: https://en.wikipedia.org/wiki/MIT_License
1928

2029
[evolved]: https://github.com/BlackMATov/evolved.lua
2130

2231
- [Introduction](#introduction)
2332
- [Performance](#performance)
33+
- [Benchmarks](#benchmarks)
2434
- [Simplicity](#simplicity)
2535
- [Flexibility](#flexibility)
2636
- [Installation](#installation)
@@ -56,6 +66,7 @@
5666
- [Fragment Requirements](#fragment-requirements)
5767
- [Destruction Policies](#destruction-policies)
5868
- [Custom Component Storages](#custom-component-storages)
69+
- [Error Handling](#error-handling)
5970
- [Garbage Collection](#garbage-collection)
6071
- [Cheat Sheet](#cheat-sheet)
6172
- [Aliases](#aliases)
@@ -65,6 +76,7 @@
6576
- [Chunk](#chunk)
6677
- [Builder](#builder)
6778
- [Changelog](#changelog)
79+
- [v1.11.0](#v1110)
6880
- [v1.10.0](#v1100)
6981
- [v1.9.0](#v190)
7082
- [v1.8.0](#v180)
@@ -88,6 +100,10 @@ This library is designed to be fast. Many techniques are employed to achieve thi
88100

89101
Not all the optimizations I want to implement are done yet, but I will be working on them. However, I can already say that the library is fast enough for most use cases.
90102

103+
#### Benchmarks
104+
105+
The library contains some micro-benchmarks for internal use in the [develop/benchmarks](./develop/benchmarks/) directory, but they are not comprehensive and are not intended for comparison with other ECS libraries. I don't like cross-library benchmarks, as they are often biased and not representative of real-world performance. However, you can look at benchmarks from independent third-party authors, for example, [these](https://github.com/jeffzi/lua-ecs-benchmark) nice benchmarks by [@jeffzi](https://github.com/jeffzi) that cover most libraries, including `evolved.lua`.
106+
91107
### Simplicity
92108

93109
I have tried to keep the [API](#cheat-sheet) as simple and intuitive as possible. I also keep the number of functions under control. All the functions are self-explanatory and easy to use. After reading the [Overview](#overview) section, you should be able to use the library without any problems.
@@ -1416,6 +1432,24 @@ evolved.builder()
14161432
evolved.process_with(MOVEMENT_SYSTEM, 0.016)
14171433
```
14181434

1435+
### Error Handling
1436+
1437+
Since systems perform processing in a deferred scope, any errors that occur during processing can leave the library in an inconsistent state. To handle this, the library runs a protected call for each system and catches any errors that occur. By default, the library will collect the error message and the current stack trace and rethrow the error with this information. It is safe to catch errors, but it can be inconvenient to use with a debugger, because debuggers usually break on the rethrow instead of the place where the error happened. To make it easier to debug errors in systems, the library provides a way to set a custom error handler that will be called when an error occurs during system processing. For example, you can set an error handler that breaks into the debugger:
1438+
1439+
```lua
1440+
-- we use Local Lua Debugger in this example
1441+
local debugger = require 'lldebugger'
1442+
debugger.start()
1443+
1444+
local evolved = require 'evolved'
1445+
evolved.error_handler(function(message)
1446+
debugger.requestBreak()
1447+
return debug.traceback(message)
1448+
end)
1449+
```
1450+
1451+
This way, when an error occurs during system processing, the error handler will be called, which will break into the debugger, allowing you to inspect the state of the program at the moment of the error. After you continue execution in the debugger, the error will be rethrown with the original message and stack trace.
1452+
14191453
### Garbage Collection
14201454

14211455
While using the library, some internal data structures can become obsolete and should be cleaned up to free memory. For example, empty chunks that no longer contain entities can be removed. Component storages can also have unused capacity that can be shrunk to save memory. The library provides a function to control this garbage collection process.
@@ -1577,6 +1611,7 @@ process :: system... -> ()
15771611
process_with :: system, ... -> ()
15781612
15791613
debug_mode :: boolean -> ()
1614+
error_handler :: {string -> string}? -> ()
15801615
collect_garbage :: boolean? -> ()
15811616
```
15821617

@@ -1668,6 +1703,12 @@ builder_mt:destruction_policy :: id -> builder
16681703

16691704
## Changelog
16701705

1706+
### v1.11.0
1707+
1708+
- Slightly improved performance of modifying operations for fragments with [`ON_INSERT`](#evolvedon_insert) and [`ON_REMOVE`](#evolvedon_remove) hooks
1709+
- Slightly improved performance of queries with [`EXPLICIT`](#evolvedexplicit) fragments
1710+
- Added the new [`evolved.error_handler`](#evolvederror_handler) function that allows setting a custom error handler for better system processing debugging experience
1711+
16711712
### v1.10.0
16721713

16731714
- Added the new [`evolved.lookup`](#evolvedlookup) and [`evolved.multi_lookup`](#evolvedmulti_lookup) functions that allow finding ids by their names
@@ -2187,6 +2228,13 @@ function evolved.process_with(system, ...) end
21872228
function evolved.debug_mode(yesno) end
21882229
```
21892230

2231+
### `evolved.error_handler`
2232+
2233+
```lua
2234+
---@param handler? fun(message: string): string
2235+
function evolved.error_handler(handler) end
2236+
```
2237+
21902238
### `evolved.collect_garbage`
21912239

21922240
```lua

develop/all.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require 'develop.testing.build_tests'
2+
require 'develop.testing.cached_hooks_tests'
23
require 'develop.testing.cancel_tests'
34
require 'develop.testing.clone_tests'
45
require 'develop.testing.depth_tests'

0 commit comments

Comments
 (0)