var.recall
Revision as of 13:19, 1 June 2011 by Jimbauwens (talk | contribs) (Created page with "var.'''recall''' is a function that is part of the Var Library. <br> The function returns a the content of a math variable in the current document. It tries to return th...")
var.recall is a function that is part of the Var Library.
The function returns a the content of a math variable in the current document. It tries to return the value in a compatible Lua type. If there is no compatible type, it returns nil and an error message.
Syntax
var.recall(varname)
returns the content of the variable varname (must be a string).
Example
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
This code retrieves the content of the variable sol (number), and prints it on the screen.