mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-27 08:39:30 +00:00
[doc] update doc
This commit is contained in:
parent
a31fefc68b
commit
ed7fe34853
6 changed files with 19 additions and 18 deletions
|
|
@ -118,7 +118,7 @@ State = class {
|
|||
self.scope:define_lua(name, value, func, raw_mode)
|
||||
end,
|
||||
--- Returns true if `name` (string) is defined in the global scope.
|
||||
--- Returns false otherwise.
|
||||
-- Returns false otherwise.
|
||||
defined = function(self, name)
|
||||
self.scope:push_global()
|
||||
local r = self:defined_local(name)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ return {
|
|||
--
|
||||
-- ```
|
||||
-- :i = 1
|
||||
-- while(i <= 5)
|
||||
-- while($i <= 5)
|
||||
-- print(i)
|
||||
-- i += 1
|
||||
-- // 1, 2, 3, 4, 5
|
||||
|
|
@ -117,7 +117,7 @@ return {
|
|||
--
|
||||
-- ```
|
||||
-- :i = 1
|
||||
-- while(i <= 5)
|
||||
-- while($i <= 5)
|
||||
-- if(i == 3, break)
|
||||
-- print(i)
|
||||
-- i += 1
|
||||
|
|
@ -126,7 +126,7 @@ return {
|
|||
--
|
||||
-- ```
|
||||
-- :i = 1
|
||||
-- while(i <= 5)
|
||||
-- while($i <= 5)
|
||||
-- if(i == 3, continue)
|
||||
-- print(i)
|
||||
-- i += 1
|
||||
|
|
@ -135,7 +135,7 @@ return {
|
|||
--
|
||||
-- ```
|
||||
-- :i = 10
|
||||
-- while(i <= 5)
|
||||
-- while($i <= 5)
|
||||
-- print(i)
|
||||
-- i += 1
|
||||
-- else!
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ _defined at line 117 of [anselme/state/State.lua](../anselme/state/State.lua):_
|
|||
|
||||
### :defined (name)
|
||||
|
||||
Returns true if `name` (string) is defined in the global scope.
|
||||
Returns false otherwise.
|
||||
|
||||
_defined at line 122 of [anselme/state/State.lua](../anselme/state/State.lua):_ `defined = function(self, name)`
|
||||
|
|
@ -311,4 +312,4 @@ Otherwise, each Node has its own module file defined in the [ast/](../ast) direc
|
|||
|
||||
|
||||
---
|
||||
_file generated at 2024-06-04T14:22:53Z_
|
||||
_file generated at 2024-11-09T17:00:43Z_
|
||||
|
|
@ -326,7 +326,7 @@ comment
|
|||
|
||||
Variables can be defined and assigned using the `_=_` operator.
|
||||
|
||||
To define a variable, the left expression must be a [symbol](#symbol), for an assignment, an identifier. The left expression can also be a tuple for multiple assignments.
|
||||
To define a variable, the left expression must be a [symbol](#symbols), for an assignment, an identifier. The left expression can also be a tuple for multiple assignments.
|
||||
|
||||
```
|
||||
:x = 3 // definition
|
||||
|
|
@ -355,11 +355,11 @@ constant symbol = 13 // value checking error!
|
|||
|
||||
#### Exported variables
|
||||
|
||||
If the symbol has an export flag, the variable will be defined in the [export scope](#export-scope) instead of the current scope, i.e. will be defined for the whole file and be made accessible from outside files. See [export scope](#export-scope) for details.
|
||||
If the symbol has an `@` export flag, the variable will be defined in the [export scope](#export-scope) instead of the current scope, i.e. will be defined for the whole file and be made accessible from outside files. See [export scope](#export-scope) for details.
|
||||
|
||||
#### Alias variables
|
||||
|
||||
If the symbol has an alias flag, the variable will be an alias. Instead of directly accessing the value of the variable, the variable will:
|
||||
If the symbol has an `&` alias flag, the variable will be an alias. Instead of directly accessing the value of the variable, the variable will:
|
||||
|
||||
* when get, call its value with no argument and returns the result;
|
||||
* whet set, call its value with an assignment argument and returns the result.
|
||||
|
|
@ -752,7 +752,7 @@ $1, $2 // same as ($1), ($2) as _,_ has a precedence of 2
|
|||
|
||||
A variable can be defined and assigned a new function quickly using the function definition syntax.
|
||||
|
||||
The function definition syntax consist of a modified [symbol literal](#symbol) with a `$` right before the symbol name, followed by either a parameter list and expression or the function expression directly, in the same way as the [`$_` operator](#functions) described above.
|
||||
The function definition syntax consist of a modified [symbol literal](#symbols) with a `$` right before the symbol name, followed by either a parameter list and expression or the function expression directly, in the same way as the [`$_` operator](#functions) described above.
|
||||
|
||||
When evaluated, the function definition will create a new function and define a new variable set to this function.
|
||||
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ If a `break` happens in the loop, the whole loop is stopped.
|
|||
|
||||
```
|
||||
:i = 1
|
||||
while(i <= 5)
|
||||
while($i <= 5)
|
||||
print(i)
|
||||
i += 1
|
||||
// 1, 2, 3, 4, 5
|
||||
|
|
@ -304,7 +304,7 @@ while(i <= 5)
|
|||
|
||||
```
|
||||
:i = 1
|
||||
while(i <= 5)
|
||||
while($i <= 5)
|
||||
if(i == 3, break)
|
||||
print(i)
|
||||
i += 1
|
||||
|
|
@ -313,7 +313,7 @@ while(i <= 5)
|
|||
|
||||
```
|
||||
:i = 1
|
||||
while(i <= 5)
|
||||
while($i <= 5)
|
||||
if(i == 3, continue)
|
||||
print(i)
|
||||
i += 1
|
||||
|
|
@ -322,7 +322,7 @@ while(i <= 5)
|
|||
|
||||
```
|
||||
:i = 10
|
||||
while(i <= 5)
|
||||
while($i <= 5)
|
||||
print(i)
|
||||
i += 1
|
||||
else!
|
||||
|
|
@ -1336,4 +1336,4 @@ _defined at line 14 of [anselme/stdlib/wrap.lua](../anselme/stdlib/wrap.lua):_ `
|
|||
|
||||
|
||||
---
|
||||
_file generated at 2024-06-04T14:22:53Z_
|
||||
_file generated at 2024-11-09T16:02:36Z_
|
||||
|
|
@ -225,7 +225,7 @@ else!
|
|||
|
||||
```
|
||||
:i = 0
|
||||
while(i < 5)
|
||||
while($i < 5)
|
||||
i += 1
|
||||
if(i == 4)
|
||||
break!
|
||||
|
|
@ -240,7 +240,7 @@ for(:x, range(10))
|
|||
|
||||
# Persistence
|
||||
|
||||
_For more detailled information on this, look at [persistence](standard_library.md#persistence-helpers), [alias variables](#api.md#alias-variables)._
|
||||
_For more detailled information on this, look at [persistence](standard_library.md#persistence-helpers), [alias variables](language.md#alias-variables)._
|
||||
|
||||
Variables that needs to be saved and loaded alongside the game's save files can be stored in persistent storage.
|
||||
|
||||
|
|
@ -333,4 +333,4 @@ Text and any value preceded by a `%` prefix will be replaced with its translatio
|
|||
%"red" // "rouge"
|
||||
```
|
||||
|
||||
An Anselme script containing a ready-to-translate list of all translatables elements of a file can be obtained using the [translation template generator Lua API methods](#api.md#generate-translation-template). The template can then be loaded as a regular Anselme file for all the translations to be applied.
|
||||
An Anselme script containing a ready-to-translate list of all translatables elements of a file can be obtained using the [translation template generator Lua API methods](api.md#generate-translation-template). The template can then be loaded as a regular Anselme file for all the translations to be applied.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue