Answer the question
In order to leave comments, you need to log in
Which embeddable language to choose: Lua or Python?
Task: I am developing a small computer toy in C ++, and I need to attach a scripting language to it.
Why do I need this: to simplify writing the logic of bots (the main feature of the game is the intelligence of enemies), to allow players to modify this logic.
Of all the languages, Lua and Python are the most popular.
I've figured out Lua a bit (read a decent amount of manuals and written a little toy) and now I'm dealing with Python in the same way.
So far, I like Python more, but this is only a first glance.
I'm mainly interested in the following questions:
1. What level of problem can each of these languages solve together with C++ without using a lot of crutches?Is it difficult, for example, in Lua or Python to use objects created in C ++?
2. What are the pitfalls when working with these bundles of languages that you have encountered?
3. Is it true that Lua significantly outperforms Python in terms of speed? Is this fair when embedding these languages in C++ code?
Answers to these questions are difficult to get at the first acquaintance with the language, but I believe that they are quite important.
I would like to hear, first of all, the opinion of people who have already worked with C ++ & Lua or C ++ & Python.
Answer the question
In order to leave comments, you need to log in
Lua is very much loved by game developers and I think it's not just that.
Lua is indeed very fast (the fastest scripting language)
and there is a lot of documentation on how to use it.
ps python is also good, but in this case, inferior to lua.
Python solves almost any task, in relation to Lua there is a huge number of libraries and various implementations, when Lua itself is a pure VM with minimal functionality (lua pipe, io, etc.). For embedding, it's better to use Lua , because there is nothing superfluous in it.
lua has its limitations when working with inserts into text lines (at least in 5.1 for sure), there is no continue (this is of course solvable but creates some inconvenience), but in general lua is very fast. I use it for working with strings mainly, parsing and the like. The very fast work of the language is incredibly pleasing + a lot of good documentation.
Worked with a bunch of BD + and CarlML, you simply cannot find the best
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question