From Inspired-Lua Wiki
Revision as of 10:33, 14 April 2016 by Adriweb (talk | contribs) (→‎Example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search is a function that is part of the Var functions.

The function set the content of a variable in the current document.
Returns nil when the operation succeeded, otherwise an error message.

Syntax, data)

Parameter Type Description
string The name of the math variable you want to store stuff in.
anything the data you want to store in varname. Can be a number, string, table etc.


--Adriweb (talk) 11:33, 14 April 2016 (CEST)

function"sol", 1400000)

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")

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