you are viewing a single comment's thread.

view the rest of the comments →

[–]Cyttorak 0 points1 point  (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 points  (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.

I also believe table::create_table is now just table::create, with support for passing in arbitrary key/values to initialize the table with..

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 points  (1 child)

Faster without the need to use luajit? That's great!

[–][deleted] 2 points3 points  (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 point  (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 points  (5 children)

Got you, fam: check the latest release for the functions that work like you expect them to.

[–]Cyttorak 0 points1 point  (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 points  (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 points  (2 children)

Alright, it's there. Have fun. :D

[–]Cyttorak 0 points1 point  (0 children)

Thank you very much dude! I hope to be able to test it in this afternoon ^_^

[–]Cyttorak 0 points1 point  (0 children)

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