Difference between revisions of "Eval"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Odessa
(bracket placement mistake in example code)
imported>Odessa
(fixed link typo)
Line 36: Line 36:
*If struggling to understand the purpose of 'eval', then by analogy think of 'if eval' as simply telling the GECK compiler the line is written in NVSE language, to prevent it complaining with an error.
*If struggling to understand the purpose of 'eval', then by analogy think of 'if eval' as simply telling the GECK compiler the line is written in NVSE language, to prevent it complaining with an error.
==See Also==
==See Also==
*[[User Defined Functions]]
*[[User Defined Function]]
*[[Array Variables]]
*[[Array Variables]]
*[[String Variables]]
*[[String Variables]]

Revision as of 00:31, 28 May 2014

< [[::Category:Functions|Category:Functions]]

A function added by the New Vegas Script Extender.

Description

Added by NVSE V4. Reduces an expression to a boolean for use in conditional statements. Used to permit the usage of any function or expression that may be so reduced for a conditional, when the compiler would otherwise disallow it.

Eval is required to test the value of user defined functions, and those related to arrays and strings in conditionals.

Syntax

[help]
(boolean) Eval expression:reducable

Example

array_var aBeatles

let aBeatles := ar_List JohnREF, PaulREF, GeorgeREF, RingoREF

if eval (aBeatles[3] == RingoREF) ; * test the fourth element of array is Ringo
    ; Do something
endif


if eval (Ar_Size aBeatles) > 0 ; * test array holds more than zero elements
    ; Do something
endif


if eval (Call SomeSuitableUDF) ; * test the user defined function returns true
    ; Do something
endif

Notes

  • If struggling to understand the purpose of 'eval', then by analogy think of 'if eval' as simply telling the GECK compiler the line is written in NVSE language, to prevent it complaining with an error.

See Also