Changes

Jump to navigation Jump to search

var.store

855 bytes added, 14:27, 1 June 2011
Created page with "var.'''store''' is a function that is part of the Var Library. <br> The function set the content of a variable in the current document. Returns nil when the operation su..."
var.'''store'''&nbsp;is a function that is part of the Var Library.

<br>

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)'''<br> stores data in the variable varname (must be a string).

== Example ==

<source lang="lua">
function on.create()
var.store("sol","very very very many")
end

function on.paint(gc)
variable = var.recall("sol") --assuming that sol exists
gc:drawString("The diameter of the sun is " .. tostring(variable) .. " KM", 10, 10, "top")
end
</source>

This code retrieves the content of the variable sol (string), and prints it on the screen.

== See also ==

*[[var.list]]<br>
*[[var.recallstr]]<br>
*[[var.recall]]<br>
*[[var.monitor]]<br>
*[[var.unmonitor]]<br>

[[Category:var]]
68

edits

Navigation menu