Lambdas/Anon.Functions: Status, implementation

Started by
1 comment, last by Xynu Shinizuki 8 years, 3 months ago

Heya. Finally made it to the forum :)

Recently I revived a concept for one of my projects and in reaction also brought back an old tool of mine. This has lead me to also looking into my concepts regarding AngelScript again.

I'd like to know:

- Are lambdas and anonymous functions implemented, to a production-ready level?

- How are they implemented?

I know that one can make a type definition that resembles a callback signature. But then? How is it used or passed, and how can a user pass a function to native APIs and call it - and vice versa?

Would be nice to know!

Kind regards,

Ingwie.

I code in:

PHP, JavaScript (Browser/NodeJS), C/C++

My forte is in PHP and backend development - so to say, I am more a devop and my web designs usually suck :).

GitHub: https://github.com/IngwiePhoenix

I host a few mirrors on my Github:

FLTK : https://github.com/IngwiePhoenix/FLTK

AngelScript : https://github.com/IngwiePhoenix/AngelScript

Questions? Email me! I don't bite - but i byte a bit every now and then. :)

Advertisement

Hi Ingwie. Welcome to the forum! :)

Yes. anonymous functions, a.k.a. lambdas, are now supported by AngelScript (since the last public release, 2.30.2).

Implementation wise, they are just ordinary script functions and can be passed to the application as a function pointer the same way. The function pointer is represented by the asIScriptFunction interface to the application. Using the function pointer it can be called using the script context normally.

The manual has an article that shows how to pass a function pointer to the application and then calling it.

Regards,

Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I see, thank you. :)

I code in:

PHP, JavaScript (Browser/NodeJS), C/C++

My forte is in PHP and backend development - so to say, I am more a devop and my web designs usually suck :).

GitHub: https://github.com/IngwiePhoenix

I host a few mirrors on my Github:

FLTK : https://github.com/IngwiePhoenix/FLTK

AngelScript : https://github.com/IngwiePhoenix/AngelScript

Questions? Email me! I don't bite - but i byte a bit every now and then. :)

This topic is closed to new replies.

Advertisement