Creating custom component with Lua and AngelScript binding

Hi, all!

How can I create c++ component so that it is seen by both Lua and AngelScript?
I want to access some attributes and run some methods.

You have to make script bindings. It’s pretty easy for AS and pretty hard for Lua if you don’t work in fork.

I do not work in fork, but I want these to be eventually integrated, so that should be no problem.
I currently work in separate project using Urho as library. I need to start with AngelScript.
How can I do this?

Check files Urho3D/AngelScript/*API.cpp for examples

It’s very easy to bind components from your downstream project to AngelScript, but it may not work when you link to Urho3D dynamically. Example from my project where I bind my Map component:
https://github.com/KonstantinTomashevich/colonization/blob/master/sources/Colonization/AngelScriptBinders/Core/BindMap.hpp
https://github.com/KonstantinTomashevich/colonization/blob/master/sources/Colonization/AngelScriptBinders/Core/BindMap.cpp#L30
You should run Bind{ComponentName} (script) functions on application startup.


1 Like

Thanks a lot for the example!