|
1 | | -- Performance is critical. Do not use `debug.getinfo` or other debug library functions in code paths that run during method calls (e.g., wrappers, metamethods). These are too slow for hot paths. |
2 | | -- Tests do not need pcall wrappers - the test framework (menu.lua) handles errors. Only use pcall when testing that something should fail (e.g., assertFalse(success) after pcall). |
3 | | -- Do NOT add `namespace ""` to test files - the test framework (menu.lua) reloads simploo fresh for each test file, so namespace state does not persist between files. |
4 | | -- NEVER read any files in dist/ - they are probably outdated and will confuse your context. |
5 | | -- To run tests: `printf '4\n5' | lua menu.lua` (option 4 runs tests, option 5 exits). The menu requires input so you must pipe both options. |
6 | | -- To initialize simploo manually for testing outside menu.lua, load files from src/sourcefiles.txt in order: |
| 1 | +- Performance is critical. No `debug.getinfo` in hot paths (wrappers, metamethods). |
| 2 | +- Tests don't need pcall - menu.lua handles errors. Only use pcall when testing failures. |
| 3 | +- Don't add `namespace ""` to tests - simploo reloads fresh per test file. |
| 4 | +- NEVER read dist/ files - outdated. |
| 5 | +- Run tests: `printf '4\n5' | lua menu.lua` |
| 6 | +- Manual init (outside menu.lua): load files from src/sourcefiles.txt in order: |
7 | 7 | ```lua |
8 | | - local file = io.open("src/sourcefiles.txt", "r") |
9 | | - local content = file:read("*all") |
10 | | - file:close() |
11 | | - for name in string.gmatch(content, "[^\r\n]+") do |
| 8 | + for name in io.open("src/sourcefiles.txt"):read("*a"):gmatch("[^\r\n]+") do |
12 | 9 | dofile("src/" .. name) |
13 | 10 | end |
14 | 11 | ``` |
15 | | -- ALWAYS read all files in src/ before you start working - unless explicitly told not to. |
16 | | -- If asked to benchmark, READ the existing benchmark in README.md and give a COMPARISON to those numbers. We always benchmark to see if code became better or worse, not on its own. If printing tables, ensure the spacing is right. Always run benchmarks via menu.lua. |
| 12 | +- ALWAYS read all src/ files before working (unless told not to). |
| 13 | +- Benchmarks: compare to README numbers, run all 3 lua versions, ask to update README. |
0 commit comments