🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to enable scripting in my engine

Started by
14 comments, last by mr_tawan 5 years, 11 months ago
On 7/5/2018 at 5:44 PM, Hodgman said:

Lua really has a minimalist philosophy in letting it be used in many ways. Unless you're a minimalist fan yourself and a C programmer, the push/pop VM stack stuff should only be used by a binding library for your language (e.g. a Lua<->C++ binding layer). 

Lua also lacks class-based OOP facilities out of the box, but has all the tools required to build a class system yourself.

If you're high level OO programmer, then yeah, vanilla Lua is probably too minimalist, but... Lua plus a few additional libraries does bridge the gap. 

While I love getting down and dirty with code, there's something to be said about higher level languages. I would much prefer Ruby or Python over LUA. Does anyone here have any experience binding them to C++?

Advertisement

I would just like to say thank you to all those who have contributed to this post. I am reviewing all of the information.

I have noticed that LUA doesn't take advantage of OOP, does anyone know of how to say use Python for a scripting language rather than LUA or maybe C#.

I would like to retain as much OOP as possible.

Thank you so much guys :)

“When I look at myself in the mirror, I see a unicorn……a badass unicorn!” ~ Alice Turner

12 hours ago, AliceKylie said:

does anyone know of how to say use Python for a scripting language

There's lots of options. Check out this SO thread on the topic : https://stackoverflow.com/questions/145270/calling-c-c-from-python

12 hours ago, AliceKylie said:

or maybe C#

You can download the source code of the mono project, they also have a compact version of mono runtime available as C/C++ source. This will be able to load and run .Net assemblies in a more or less supported way.

A project that uses mono to make C# available to HTML/Javascript for example is Electron.

Related to this block post, it seems to be very easy to include the mono runtime into any C/C++ based application so try it, I will do the same (later) :D

Looks like you prefer the larger, more complex languages like Python, Ruby, or even C#. Personally if I go with that route, I'd instead write majority of code in the scripting language and only create a C/C++ function (with binding) in the area that needs performance.

This is of course an opposite to the embedding method (which majority of code is written in C/C++, and use scripting language only in the area that needs customization like the AI code). In this case I'd use Chaiscript or Lua.  

http://9tawan.net/en/

This topic is closed to new replies.

Advertisement