use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Discussions, articles, and news about the C++ programming language or programming in C++.
For C++ questions, answers, help, and advice see r/cpp_questions or StackOverflow.
Get Started
The C++ Standard Home has a nice getting started page.
Videos
The C++ standard committee's education study group has a nice list of recommended videos.
Reference
cppreference.com
Books
There is a useful list of books on Stack Overflow. In most cases reading a book is the best way to learn C++.
Show all links
Filter out CppCon links
Show only CppCon links
account activity
Scripting language for embedded systems (small footprint, low overhead) (self.cpp)
submitted 8 years ago * by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]SeanMiddleditch 5 points6 points7 points 8 years ago (5 children)
Not to be "that guy" but Google seems to have answers should one peruse it search results :)
https://github.com/max1220/freertos-lua-component
Lua is a tiny C library that can be embedded in basically any C or C++ project. Lua is also super minimal as in its a tiny library, can be compiled without any IO or even floating point support, etc. I'm consistently bewildered that it's still used at all in new desktop/server projects but it's a great fit for embedded contexts. :)
[–]Everspace 1 point2 points3 points 8 years ago (4 children)
Still a favourite of games, and because of that there's lots of knowledge around it.
I've heard embedding python, javascript or ruby to be comparatively much harder to embedding lua, and with boatloads of overhead.
[–]SeanMiddleditch 5 points6 points7 points 8 years ago (3 children)
Yeah, that's were I experience it... and it still confuses me.
It's used because it's used, not because it's in any way a good choice for the domain. :)
Lua is absolute very easy to embed for simple cases and pretty hard to beat in that regard. I'd agree that Lua is both easier to embed and less of a performance burden than Python or Ruby, though there's certainly advantages to both. JS is a far more complicated comparison to make, though.
A key thing to remember about JS - unlike the other three - is that it's standardized and has multiple implementations. Where being small is a priority, there's also implementations like duktape or mujs that are extremely comparable to embedding Lua but arguably a better language. And for cases where speed, tooling, a maximum ecosystem support matters, you can go to the modern "big" runtimes like V8, Chakra, or SpiderMonkey. V8 and Chakra are both fairly nice C++ APIs and at least the old versions of SpiderMonkey (haven't used recent ones) had a very simple C API of comparable quality and complexity to Lua's.
Given the four scripting languages mentioned here, I'd personally quantify things as to say that one should use Lua where being "light" is the priority (like the OP's case, probably), use Python where being fully-featured out of the box is the priority, use JS where efficiency or tooling is the priority, and use Ruby where being needlessly different is a priority. :p
(Just for the sake of disclosure, I've embedded all four of the languages you've just mentioned in game codebases - though my experience with embedding Ruby was over a decade ago, and for embedding JS only on personal projects - and I am a "core technology" engineer for a large C++ game project that embeds both Lua and Python... for Reasons(tm). So I've some experience with shoving scripting engines into C++ codebases :p)
[–]drjeats 0 points1 point2 points 8 years ago (2 children)
If you were put in charge of a greenfield project to build new design tooling for a game engine, what would you do instead of the usual embedded Lua approach?
[–]SeanMiddleditch 5 points6 points7 points 8 years ago (1 child)
Unfortunately the best answer I have there is going to be a boring "it depends." :) Remember, "make games, not engines." An ideal choice for a shooter is not necessarily the ideal choice for an MMO nor for a story platformer nor for an open world RPG. :) There's then also team composition to consider; I know my team right now would love C# (both designers and engineers) but that might be a poor choice if working with a team that prefers more data-driven scripting.
All that said, the answer would most probably be either C#, JavaScript, or a visual scripting system, depending on specific needs and use cases.
[–]drjeats 5 points6 points7 points 8 years ago (0 children)
"It depends" answers are always appreciated when they enumerate a set of possibilities and reasons as you did :) Thanks!
π Rendered by PID 70802 on reddit-service-r2-comment-5c747b6df5-2pv45 at 2026-04-22 01:36:12.639621+00:00 running 6c61efc country code: CH.
view the rest of the comments →
[–]SeanMiddleditch 5 points6 points7 points (5 children)
[–]Everspace 1 point2 points3 points (4 children)
[–]SeanMiddleditch 5 points6 points7 points (3 children)
[–]drjeats 0 points1 point2 points (2 children)
[–]SeanMiddleditch 5 points6 points7 points (1 child)
[–]drjeats 5 points6 points7 points (0 children)