ZigRazor / PyStateMachine

Python State Machine
GNU General Public License v3.0
8 stars 11 forks source link

Pass parameters to fn? #59

Open grapemix opened 4 hours ago

grapemix commented 4 hours ago

Is your feature request related to a problem? Please describe. In your tests, I saw an example which allows us to call an fn. For example, if we want to set the value to other values (1-99), can we reuse the fn by pass parameters other than writing 98 extra fns?

Writing duplicating fn is annoying, I can live with it. But what I really want is to compare two value to see if we can advance state, so passing parameters is the only solution.

Describe the solution you'd like For example,

<Expression>testBaseStateMachine.isOlderThan(currentAge, NewAge)</Expression>

Or

<Expression>
  <Fn>testBaseStateMachine.isOlderThan</Fn>
  <Param>
    <Value>currentAge</Value>
    <Value>NewAge</Value>
  </Param>
</Expression>

Finally, thanks for your open source work.

github-actions[bot] commented 4 hours ago

Thank you so much for your Open First Issue