import the woofer

This commit is contained in:
Haze Weathers 2025-03-01 17:50:05 -05:00
parent 825fee53e2
commit 3e89acfea8
92 changed files with 5783 additions and 0 deletions

View file

@ -0,0 +1,22 @@
static func evaluate_expression(context:String, state_chart: StateChart, expression: String, default_value:Variant) -> Variant:
var the_expression := Expression.new()
var input_names = state_chart._expression_properties.keys()
var parse_result:int = the_expression.parse(expression, input_names)
if parse_result != OK:
push_error("(" + context + ") Expression parse error : " + the_expression.get_error_text() + " for expression " + expression)
return default_value
# input values need to be in the same order as the input names, so we build an array
# of values
var input_values:Array = []
for input_name in input_names:
input_values.append(state_chart._expression_properties[input_name])
var result = the_expression.execute(input_values, null, false)
if the_expression.has_execute_failed():
push_error("(" + context + ") Expression execute error: " + the_expression.get_error_text() + " for expression: " + expression)
return default_value
return result