L3DT users' wiki
Large 3D terrain generator

set

Description

Set the value of a variable. This is equivalent to the '=' assignment operator in C/C++.

Function prototype

varref set <varref:var> <variant:VarValue>

Arguments

Name Type Comment
var varref A reference to a variable, the value of which is to be set.
VarValue variant The desired value of the variable addressed by hVar, as a variant.

Return value

NULL if an error occurred, and a valid variable reference otherwise (same as var argument).

Example

Set value of integer from literal

int i
set i 50

Set value of string from literal

string s
set s "hello"

Set value of string from a variable

float f     // create a float 'f', and initialise
set f 123.456

string s    // create a string 's'
set s f         // set the value of 's' to be 'f' (this is like 'sprintf(s, "%f", f)' in C)

echo s  // echo value of string to event log

… the output of which is written to the event log by echo as:

123.456

Set value of an integer from a fucntion

int i

set i <zs:GetLineNo> // set value of 'i' to be current line number (i.e. 2)

echo i

… the output of which is written to the event log by echo as:

2

Comments

None.

See also

 
plugins/general/zeoscript/reference/functions/set.txt · Last modified: 2017/08/31 04:39 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki