GameMaker (2.0 - 2.2.x)
Icon

Expression Evaluator

Meseta

You must be logged in to obtain assets

Description

Provides a mathematical expression evaluator. Mathematical expressions can be passed to it as a string, and solved. This allows mathematical expressions to be stored as strings, and be generated or altered at run-time.

Usage guide and support: https://meseta.itch.io/gm-expreval

Basic Usage In the most basic usage, variables are loaded into the a new expreval, and an expression is evaluated. The output variables can then be read.

// create expression
var eval = expreval_create();

// set up variables
expreval_write_variable(eval, "a", 123);

// evaluate expression (intermediate variables are created automatically
expreval_evaluate(eval, "b=2*a;c=sin(b)");

// grab output variables
var retval = expreval_read_variable(eval, "c");
show_debug_message("Returned value: " + string(retval));
expreval_destroy(eval);

Multiple expressions can be evaluated, by separating them with a semicolon in the expression string.

Any temporary or output variables used in the expression will be automatically created, and made available for reading. Referencing an undefined variable will cause an error.

exprevals must be destroyed after they are no longer used to avoid a memory leak.

End User Licence Agreement (EULA).

Age Rating: None

Version

GMS2 - Version 1.2.0. Published May 28, 2018

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait