diff --git a/REFERENCE.md b/REFERENCE.md index 821745a..ed8964a 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -903,7 +903,13 @@ This only works on strings: #### Built-in variables -TODO see stdlib/bootscript.lua +Variables for default types (each is associated to a string of the internal variable type name): `nil`, `number`, `string`, `list`, `pair`, `function reference`. + +#### Built-in languages + +Anselme provides some scripts that define translated aliases for built-in variables and functions. Currently `enUS` (English) and `frFR` (French) are provided. + +See the `stdlib/languages` for details on each language. API reference ------------- diff --git a/anselme.lua b/anselme.lua index 884dc8f..6f29869 100644 --- a/anselme.lua +++ b/anselme.lua @@ -6,11 +6,11 @@ local anselme = { -- api is incremented a each update which may break Lua API compatibility versions = { save = 1, - language = 19, - api = 3 + language = 20, + api = 4 }, -- version is incremented at each update - version = 20, + version = 21, --- currently running interpreter running = nil } diff --git a/notes.txt b/notes.txt index 34b55f5..03184fb 100644 --- a/notes.txt +++ b/notes.txt @@ -43,7 +43,11 @@ Reserved symbols that are still not used as a line type: `^+-= meh, this means we can capture choice events, and choice events contain their code block, and we don't want to store code blocks in the save file (as code can be updated/translated/whatever) TODO: the function decorator feels a bit glued-on to the current syntax diff --git a/stdlib/functions.lua b/stdlib/functions.lua index 585c76a..a3f6936 100644 --- a/stdlib/functions.lua +++ b/stdlib/functions.lua @@ -1,5 +1,6 @@ local truthy, anselme, compare, is_of_type, identifier_pattern, format_identifier, find, get_variable +--- mark a table as modified, so it will be merged on the next checkpoint if it appears somewhere in a value local function mark_as_modified(v) local modified = getmetatable(anselme.running.state.variables).modified_tables table.insert(modified, v) diff --git a/stdlib/languages/frFR.lua b/stdlib/languages/frFR.lua index b19999d..8b19c86 100644 --- a/stdlib/languages/frFR.lua +++ b/stdlib/languages/frFR.lua @@ -1,27 +1,27 @@ return [[ (Types) -~ "nil".alias("nul") -~ "number".alias("nombre") -~ "string".alias("texte") -~ "list".alias("liste") -~ "pair".alias("paire") +~ "nil"!alias("nul") +~ "number"!alias("nombre") +~ "string"!alias("texte") +~ "list"!alias("liste") +~ "pair"!alias("paire") (Built-in functions) -(~ "alias".alias("alias") -~ "name".alias("nom") -~ "value".alias("valeur") -~ "len".alias("longueur") -~ "insert".alias("ajouter") -~ "remove".alias("retirer") -~ "find".alias("trouver") -~ "error".alias("erreur") -~ "rand".alias("aléa") -~ "raw".alias("brut") -(~ "type".alias("type") -~ "is of type".alias("est de type") -~ "cycle".alias("cycler") -~ "random".alias("aléatoire") -~ "next".alias("séquence") +(~ "alias"!alias("alias") +~ "name"!alias("nom") +~ "value"!alias("valeur") +~ "len"!alias("longueur") +~ "insert"!alias("ajouter") +~ "remove"!alias("retirer") +~ "find"!alias("trouver") +~ "error"!alias("erreur") +~ "rand"!alias("aléa") +~ "raw"!alias("brut") +(~ "type"!alias("type") +~ "is of type"!alias("est de type") +~ "cycle"!alias("cycler") +~ "random"!alias("aléatoire") +~ "next"!alias("séquence") (Built-in variables) :alias 👁️ = "vu"