loreline 0.9.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@ Loreline works everywhere: game engines, web apps, or standalone projects. It ad
8
8
 
9
9
  ### Get started
10
10
 
11
- The documentation and an interactive playground are available on **[loreline.app](https://loreline.app)**.
11
+ The documentation, an interactive playground and a downloadable editor (Loreline Writer) are available on **[loreline.app](https://loreline.app)**.
12
12
 
13
13
  ## Building Loreline
14
14
 
@@ -29,12 +29,15 @@ npm install # Install Node.js dependencies (esbuild, tsx, etc.)
29
29
  node ./setup --js # Build JavaScript library (js/loreline.js)
30
30
  node ./setup --cs # Export C# source files (cs/Loreline/)
31
31
  node ./setup --cs --cs-dll # Export C# + build Loreline.dll
32
- node ./setup --cs-generics # Export C# test runner without erase-generics (see CS_COMPATIBILITY.md)
32
+ node ./setup --cs-generics # Export C# test runner without erase-generics
33
33
  node ./setup --py # Build Python package (py/loreline/)
34
34
  node ./setup --lua # Build Lua module (lua/loreline/)
35
+ node ./setup --php # Build PHP package (php/)
36
+ node ./setup --php-cli # Build PHP CLI (build/php-cli/)
35
37
  node ./setup --cpp # Build native CLI (loreline / loreline.exe)
36
38
  node ./setup --cpp-lib # Build C++ shared library
37
39
  node ./setup --jvm # Build JVM jar (jvm/loreline.jar)
40
+ node ./setup --gdscript # Export pure-GDScript Godot addon (godot/gdscript/)
38
41
  ```
39
42
 
40
43
  ### Setting up samples
@@ -55,17 +58,28 @@ For loreline-lua, run `--lua` first.
55
58
 
56
59
  ### Testing
57
60
 
58
- Python, Lua, JS, and JVM tests require running the corresponding build step first (e.g. `node ./setup --py` before Python tests).
61
+ Python, Lua, PHP, JS, JVM and GDScript tests require running the corresponding build step first (e.g. `node ./setup --py` before Python tests). GDScript tests also need a Godot 4 binary on the PATH (or pointed to by the `GODOT_BIN` environment variable).
59
62
 
60
63
  ```sh
61
64
  node run test ./test # Run Neko tests only
62
65
  python3 py/test-runner.py ./test # Run Python tests only
63
66
  lua5.4 lua/test-runner.lua ./test # Run Lua tests only
67
+ php php/test-runner.php ./test # Run PHP tests only
68
+ php build/php-cli/index.php test ./test # Run PHP CLI tests only
64
69
  npx tsx js/test-runner.ts ./test # Run JS tests only
65
70
  java -cp jvm/loreline.jar:build/jvm/test TestRunner ./test # Run JVM tests only
66
- node ./setup --test # Build and run all test suites (Neko + C# + C# AOT + C# (with generics) + JS + C++ lib + Python + Lua + JVM)
71
+ node ./setup --gdscript-test # Run GDScript tests only (headless Godot)
72
+ node ./setup --test # Build and run all test suites (Neko + C# + C# AOT + C# (with generics) + JS + C++ lib + Python + Lua + PHP + PHP CLI + JVM)
67
73
  ```
68
74
 
75
+ ### How Loreline is authored
76
+
77
+ Loreline's runtime is essentially handwritten, so the code you embed when depending on it can be considered almost entirely free of AI-generated code.
78
+
79
+ That said, I used coding assistants for peripheral work: unit-tests, scaffolding, debugging, documenting the code, continuous integration, and help in making surgical changes to the runtime. These improve the overall reliability and quality of Loreline, make sure that anything tested won't break in the future, and give me more bandwidth for the more creative, interesting and trickier parts of Loreline itself. I weighed that this targeted use would benefit the users of the project, and I take entire responsibility for all the code and design choices in this repository.
80
+
81
+ For some context on where I stand, I don't endorse the use of generative AI as a general rule: I do care a lot about writing code myself and human authorship in general, and I also don't use any AI-generated assets or content for the games I make.
82
+
69
83
  ## License
70
84
 
71
85
  MIT License
package/js/loreline.d.ts CHANGED
@@ -275,7 +275,7 @@ export class Loreline {
275
275
  *
276
276
  * For each file involved in the script (root + transitively imported), the
277
277
  * corresponding translation file is looked up by inserting `.<locale>` before
278
- * the extension (e.g. `characters.lor` → `characters.fr.lor`). Missing translation
278
+ * the extension (e.g. `characters.lor` -> `characters.fr.lor`). Missing translation
279
279
  * files are silently skipped. The returned map can be passed as
280
280
  * `InterpreterOptions.translations` to `play()` or `resume()`.
281
281
  *
@@ -302,9 +302,9 @@ export class Loreline {
302
302
  *
303
303
  * By default only `.<locale>.lor` files are tried by `loadLocale`. Call
304
304
  * this to opt in to additional formats:
305
- * - `"po"` — GNU gettext PO (`.po`)
306
- * - `"xliff"` — XLIFF 1.2 / 2.x (`.xliff`, `.xlf`)
307
- * - `"csv"` — CSV / TSV (`.csv`, `.tsv`)
305
+ * - `"po"`: GNU gettext PO (`.po`)
306
+ * - `"xliff"`: XLIFF 1.2 / 2.x (`.xliff`, `.xlf`)
307
+ * - `"csv"`: CSV / TSV (`.csv`, `.tsv`)
308
308
  *
309
309
  * Unknown names are accepted silently (forward-compat for future formats).
310
310
  *
@@ -322,7 +322,7 @@ export class Loreline {
322
322
  * call throws, and this is set to the same error so it can be inspected
323
323
  * after the catch.
324
324
  *
325
- * Not thread-safe — read immediately after the call returns.
325
+ * Not thread-safe: read immediately after the call returns.
326
326
  */
327
327
  static lastError(): Error | null;
328
328
 
@@ -399,6 +399,10 @@ export class Interpreter {
399
399
  /**
400
400
  * Gets a specific field of a character.
401
401
  *
402
+ * Container values (key-value objects and arrays) are plain JS objects
403
+ * and arrays: field accessors and custom functions exchange idiomatic
404
+ * JS values in both directions.
405
+ *
402
406
  * @param character The name of the character
403
407
  * @param name The name of the field to get
404
408
  * @return The field value or null if the character or field doesn't exist