[dismiss]
This wiki is a copy of the original Oblivion CS wiki created and maintained by the UESP.net. See CSwiki:Copy Notice for more info.
TestExpr
Jump to navigation
Jump to search
A command for Oblivion Script Extender
Syntax:
(bool) TestExpr expr
Attempts to evaluate an expression, returning false if an error occurs during evaluation and true otherwise. This can be useful when checking if an array index is out of bounds or if an element exists with a given key, among other things. TestExpr suppresses the output of error messages to the console and log file.
Examples[edit | edit source]
array_var array let array := ar_Construct Array if testexpr (array[5] := 2) PrintC "5 is a valid index, assignment succeeded." else PrintC "Index 5 is out of bounds, no assignment." endif let array := ar_Construct StringMap if testexpr (array["INDEX"]) PrintC "An element exists in array with key 'INDEX'" else PrintC "No element with the specified key exists." endif