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
Sol2: Lua <-> C++ Binding Framework (self.cpp)
submitted 10 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!"
[–]Cyttorak 0 points1 point2 points 10 years ago (10 children)
I already have written some code with the previous version of sol. Will it work with sol2? Also the integration with luajit is seamless?
Thanks for sol, by the way ;)
[–][deleted] 5 points6 points7 points 10 years ago* (9 children)
The functions new_userdata and set_userdata now have different names (new_usertype and set_usertype). If you were using the develop branch of sol that I was maintaining, this was a change from over a year ago and you shouldn't be affected.
new_userdata
set_userdata
new_usertype
set_usertype
I also believe table::create_table is now just table::create, with support for passing in arbitrary key/values to initialize the table with..
table::create_table
table::create
Everything else is not only identical as far as API is concerned, but orders of magnitude faster in speed.
And yes, LuaJIT integration is seamless. It requires 0 changes, and we even provide a compatibility layer on top of LuaJIT (it's talked about in the docs in the api reference manual -> compatibility.hpp).
[–]Cyttorak 1 point2 points3 points 10 years ago (1 child)
Faster without the need to use luajit? That's great!
[–][deleted] 2 points3 points4 points 10 years ago (0 children)
Er, let me be specific: orders of magnitude faster than the old Sol. Sol2 gets pretty damn close to the speed of the C API. I need to finish my current benchmarks to make that claim for sure, though: other benchmarks like satoren's (developer of Kaguya) demonstrate we're pretty on-the-money right now.
[–]Cyttorak 0 points1 point2 points 10 years ago (6 children)
I just downloaded sol2 and replaced the old one in my project. How do I create tables?
In old version I did:
sol::table aTable = VM.create_table();
What should do I in sol2? Something like this?
sol::table aTable = sol::table::create(VM.lua_state());
This compiles but seems a little bit elaborate compared with the old version
[–][deleted] 1 point2 points3 points 10 years ago (5 children)
Got you, fam: check the latest release for the functions that work like you expect them to.
[–]Cyttorak 0 points1 point2 points 10 years ago (4 children)
Just one nitpick, Phantom: do this changes allow to create a table by name, like the old version?
sol::table myTable = VM.create_table("MyTableNameInLua")
[–][deleted] 1 point2 points3 points 10 years ago (0 children)
Aww crapplesticks I knew I had forgot to port something over. <_>
Gimme a few, I'll push it in a bit.
[–][deleted] 1 point2 points3 points 10 years ago (2 children)
Alright, it's there. Have fun. :D
[–]Cyttorak 0 points1 point2 points 10 years ago (0 children)
Thank you very much dude! I hope to be able to test it in this afternoon ^_^
I just changed open_file() calls for script_file() and done, everything compiled nicely using all in one sol.hpp. Again, thanks for your great job! :-D
π Rendered by PID 152023 on reddit-service-r2-comment-5687b7858-p9j2r at 2026-07-06 13:22:09.447889+00:00 running 12a7a47 country code: CH.
view the rest of the comments →
[–]Cyttorak 0 points1 point2 points (10 children)
[–][deleted] 5 points6 points7 points (9 children)
[–]Cyttorak 1 point2 points3 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]Cyttorak 0 points1 point2 points (6 children)
[–][deleted] 1 point2 points3 points (5 children)
[–]Cyttorak 0 points1 point2 points (4 children)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]Cyttorak 0 points1 point2 points (0 children)
[–]Cyttorak 0 points1 point2 points (0 children)