Environment.reassignVariable

Attempts to reassign a variable anywhere in the stack and returns a pointer to the variable or null if the variable doesn't exist or is const. If the failure is due to const, failedBecauseConst is set to true. Note: this pointer should not be stored by native functions due to modifications to the variable table that may invalidate it and result in undefined behavior.

class Environment
reassignVariable

Parameters

name string

The name of the variable to reassign.

newValue ScriptAny

The value to assign. If this is undefined and the variable isn't const, the variable will be deleted from the table where it is found.

failedBecauseConst bool

If the reassignment fails due to the variable being a const, this is set to true

Return Value

Type: ScriptAny*

A pointer to the variable in the table where it is found, or null if it was const or not located.

Meta