Line 1: |
Line 1: |
− | var.'''store''' is a function that is part of the Var Library. | + | var.'''store''' is a function that is part of the [[:Category:var|Var]] functions. |
| | | |
| <br> | | <br> |
| + | The function set the content of a variable in the current document.<br /> |
| + | Returns nil when the operation succeeded, otherwise an error message. |
| | | |
− | The function set the content of a variable in the current document. Returns nil when the operation succeeded, otherwise an error message.<br>
| + | == Syntax == |
| + | |
| + | var.'''store(varname, data)''' |
| | | |
− | == Syntax ==
| |
| | | |
− | var.'''store(varname, data)'''<br> stores data in the variable varname (must be a string).
| + | {| class="wikitable" |
| + | |- |
| + | ! Parameter !! Type !! Description |
| + | |- |
| + | | <u><center>varname</center></u> || string || The name of the ''math'' variable you want to store stuff in. |
| + | |- |
| + | | <u><center>data</center></u> || anything || the data you want to store in ''varname''. Can be a number, string, table etc. |
| + | |- |
| + | |} |
| | | |
| == Example == | | == Example == |
Line 13: |
Line 24: |
| <source lang="lua"> | | <source lang="lua"> |
| function on.create() | | function on.create() |
− | var.store("sol","very very very many") | + | var.store("sol",1400000) |
| end | | end |
| | | |
Line 22: |
Line 33: |
| </source> | | </source> |
| | | |
− | This code retrieves the content of the variable sol (string), and prints it on the screen. | + | This code store some data into the "sol" variable, retrieves the content of the variable sol (string), and prints it on the screen. |
| | | |
| == See also == | | == See also == |