doonv / bevy_dev_console

Source-inspired developer console plugin for the Bevy game engine.
Apache License 2.0
112 stars 10 forks source link

Add Functions/Closures #12

Open doonv opened 8 months ago

doonv commented 8 months ago

What problem does this solve or what need does it fill?

There is no way to make your own functions/closures inside the built-in parser.

What solution would you like?

Add a way to create your own functions/closures.

I think only implementing closures is actually the right move, mostly because its less work. But I also kinda prefer the closure syntax for creating functions in a console. Heres an example:

my_func = |a| a + 5
my_func 5
> 10