HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
ThePhD
sol2
C++2021–2026
ThePhD / sol2

sol2

Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:

5Distinct people
10Mentions
1Explicit recommenders
5.2KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

Interesting, I don't find modern C++ verbose at all. 'auto', range-based for-loops and structured bindings did a great job at reducing the verbosity of C++98. On top of that,…

spacechild1 used a recommendation phrase. One indexed comment matches. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

No other repository is repeatedly linked in the same discussions.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 12:54:37 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year10 dated mentions

Observed mentions: 2021-05-24 11:31:57 UTC to 2026-06-05 15:09:07 UTC.

0123452021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments20212022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments20232024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC505
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC000
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC101
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC202
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC202

What Hacker News says

10 sources
spacechild1·Jun 5, 2026Recommendation phrase
Interesting, I don't find modern C++ verbose at all. 'auto', range-based for-loops and structured bindings did a great job at reducing the verbosity of C++98. On top of that, C++ allows to design very concise APIs. (One of my favorite examples is sol2: https://github.com/ThePhd/sol2). Library code involving templates, on the other hand, can be pretty complex and hard to read. Concepts and other C++20 features (like [[no_unique_address]]) are certainly an improvement, but only new projects with no backwards compatibility requirements can actually use them (unconditionally).
In C++: The Documentary
I mean, if you could tell from my original post, I like C++ templates. The point is not to constantly write templates in your calling code, the point is to architect a library with templates that affords flexibility and dynamism so that the calling code is easy to write, read, and reason about. Consider, for example, the sol2[0] example usage code vs the actual source code itself[1]. 0. https://github.com/ThePhD/sol2 1. https://github.com/ThePhD/sol2/blob/develop/include/sol/func...
In Sayonara, C++, and Hello to Rust
Very interesting article! Unfortunately, it doesn't mention Lua, which in my opinion has one of the most elegant C APIs that I have seen. It is entirely stack based, which means you only need to work with primitive types, such as numbers, C strings and user provided opaque pointers. As a consequence, you never have to care about memory management because Lua doesn't even let you access the actual Lua objects. You want to create a table (= Lua's dictionary/array hybrid) and set a field "foo" to 5? lua_newtable() creates a new table and pushes it onto the stack. Then you push "foo" with lua_pushstring() and 5 with lua_pushnumber(). Finally you call lua_settable(), which pops the key and value from the stack, checks if the top of the stack contains a table, and if yes, sets the given field to the given value. The actual table structure is ne
Read the rest
ver exposed! This kind of stack manipulation might seem unusual and a bit unweildy, but what you get is safety. If you mess up the stack or perform illegal operations, Lua will call an error handler, but the VM should never crash. The stack API can be seen as the fundamental layer upon which people can create nice abstractions for their host language of choice. Examples are "sol2" for C++ (https://github.com/ThePhD/sol2) or "lupa" for Python (https://github.com/scoder/lupa) The public API is contained in "lua.h": https://github.com/lua/lua/blob/master/lua.h. "lauxlib.h" offers some useful helper functions: https://github.com/lua/lua/blob/master/lauxlib.h For comparison, this is Python's "Limited" C API: https://docs.python.org/3/c-api/stable.html#stable If you want to learn more about Lua's C API, have a look at section 4 in https://www.lua.org/manual/5.4/manual.html
In Design Issues for Foreign Function Interfaces (2004)
Well, by this I mean "unfamiliar to me", of course. Lol. Actually Lua is something to consider from the point of view of usage: it is an industry standard actually. However, all those small quirks in semantics... and classes can be done in many ways (that is what I understand, via metatables)... In ChaiSCript or Wren there is one true way and you are done. You might like it or not, but it leads to less confusion, especially if you use most of the time what is in the mainstream. This is by no means a bad thing in itself, it is just about how ergonomic or time-consuming it could be for myself: I just feel more comfortable with ChaiScript, Wren or Squirrel than with Lua. Even AngelsCript is also more similar to what you already have. So when exposing APIs there is much less friction. Truth to be told, there is also https://github.com/ThePhD/
Read the rest
sol2 which looks great and something to consider. It makes binding things quite easier and gives you object-oriented Lua. You could rely on that. It was just my subjective choice. There is no 100% right choice. Probably, if I found people that are comfortable with Lua I would use that. But the case is that this is a project of mine as it stands now.
In My experience binding a couple of scripting engines with C++

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.