ThePhD / sol2

Sol3 (sol2 v3.0) - a C++ <-> Lua API wrapper with advanced features and top notch performance - is here, and it's great! Documentation:
http://sol2.rtfd.io/
MIT License
4.16k stars 507 forks source link

[HELP] sol2 Users - Feedback Appreciated!! #189

Open ThePhD opened 8 years ago

ThePhD commented 8 years ago

Hello, users of sol2! This issue was made so that I could get a better idea of what you all use for Lua and how much you like / dislike sol2 compared to what you used to use (if anything) and sol2 now. If anyone could just reply to this issue with their thoughts, perhaps answer some of the questions below (or go on a tangent, really anything), I'd appreciate it. I'm going to be writing a paper about sol2 and the Lua landscape, so I'd like to get to know what my users use sol2 for:

Thanks for much for reading and considering, and double thanks if you do reply!

If you don't have a github, nag me on twitter with @thephantomderp or just shoot me an e-mail or something. :+1:

Nava2 commented 8 years ago
  • How did you find out / hear about sol2?

Was investigating sol originally, but found there to be bugs which were fixed in a sol2 developer branch.

  • What Lua library did you use before you found sol2?

Did not use any extensively, however, I was investigating sol and luacppinterface.

  • What do you like about sol2?

Syntax is much cleaner than other libraries.

  • What do you dislike about sol2?

Take the following with a grain of salt, as these are negatives, but I also understand why they exist.

  • Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

N/A

The documentation has become excellent and you're great at improving it when brought to your attention.

  • Anything else about the library you feel like adding or pointing out?

Keep up the activity, it's great to see. What would be helpful is having a means of "asking for help." Github issues don't seem like the place for that and there's a lot of people asking questions. Additionally, there has been a significant amount of "unprofessional" contact within the issues pages and it's off putting for enterprise types to see it.

Grant1219 commented 8 years ago

How did you find out / hear about sol2?

While searching around I found this page: http://lua-users.org/wiki/BindingCodeToLua That eventually brought me to sol2, although I tried others as well.

What Lua library did you use before you found sol2?

I used Luabind many years ago. It worked alright at the time.

What do you like about sol2?

Header only library, and even single header if you want. This makes it so much easier to integrate with an existing codebase. Very clean syntax. I'm really impressed how little I have to type to get things hooked up between C++ and Lua.

What do you dislike about sol2?

I haven't had a ton of time to use it yet, but so far I am pleased with how the code works.

Is it easier or harder from the last Lua library you used?

Definitely easier and less verbose.

Is the documentation or examples helpful?

The docs are a bit messy, but the information is all there and accessible.

If I had to suggest something it would be to provide more complex/practical examples. Most of the examples use simple types like integers, floats, strings. Showing how to properly pass/return usertype classes between C++ and Lua would be cool.

Anything else about the library you feel like adding or pointing out?

Overall I think this is the best Lua binding for C++ right now. I am using it for some server side logic for an online game at the moment (I think games are a pretty common use case for Lua scripting). When I get more time I'd like to read through more of the Sol code to understand how things work under the hood as I think it would be a good way to learn more about C++14 features.

devxkh commented 8 years ago

How did you find out / hear about sol2?

  • per random from this post: post

What're you using it for?

  • my little sparetime project: FrankE

What Lua library did you use before you found sol2?

  • selene

What do you like about sol2?

  • fastest in the land
  • lua, luajit support
  • your energy you put into this wrapper
  • fast/good support from you
  • very active

What do you dislike about sol2?

  • currently i'm just scratching the surface, so i'm happy till now

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

  • registering objects in selene was a bit easier for me. But thanks to your help and doc, i got it to work

Is the documentation or examples helpful?

  • Yes. but as every doc, it could be better, clearer and having more examples. But it's already very good for an open source project documentation.

Anything else about the library you feel like adding or pointing out?

Keep it up! don't abandon it, even if you're full with work or family! :)

jeychenne commented 8 years ago

How did you find out / hear about sol2?

I googled "C++ lua binding" and sol2 was one of the first few links.

What're you using it for?

I'm using it in an academic project. The program is a wxWidgets-based tool for natural language processing. Lua is used for plugins, and part of the high-level logic is also written in it.

What Lua library did you use before you found sol2?

I did some prototyping using the plain C API, with my own wrappers. Let's just say it wasn't fun...

What do you like about sol2?

It's very well written, header-only, there's a nice "getting started" tutorial, and most importantly it is super easy to bind C++ and Lua. Wrapping a class only takes a few minutes. It plays nice with shared_ptr.

What do you dislike about sol2?

Although the tutorial is very nice, I think the documentation itself could be improved. For example, adding your own types is not very clear, at least to me. It took me a fair amount of guess work, and I had to search in sol's source code to get it to work when I added my own Unicode String class (which was essential for me as std::string is a prank).

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

Far easier. In fact sol2 is the very reason why I decided to stick with Lua as a scripting language.

Anything else about the library you feel like adding or pointing out?

It's a really great library, keep up the good work! If you do publish a paper about sol2, please put the reference somewhere on the website so that I can cite it...

jnbrq commented 8 years ago

How did you find out / hear about sol2?

I was looking for a good way to bind my C++ APIs to Lua. Then, I googled for C++ bindings and found Sol2.

What're you using it for?

I am using it for my application based on wxWidgets which can simulate a simple robot in a 2D space, to demonstrate some algorithms on common jobs -such as maze solving, pathfinding, etc. I use Lua and Sol2 to pass algorithms to be tested, and draw using wxWidgets.

What Lua library did you use before you found sol2?

I was using Selene before Sol2. I abandoned it after experiencing very simple bugs, and learning about its speed.

What do you like about sol2?

  • Very easy to bind.
  • ThePhD working on it actively, and s/he's very responsive to issues.
  • It's header-only.
  • It surprises me when I think the library is incapable of doing something, but it does it successfully. :smile:
  • It provides a lot of code examples in tests, documentation.
  • It's documented.

What do you dislike about sol2?

  • The way we navigate the documentation is not very good. It would be better if we had a contents page, listing every title, including the subtitles in a tree form.
  • Some parts of the documentation aren't clear. You may add more examples.
  • It's a huge library using template magic. And, template magic is somehow write-only for even small libraries. And with such a hugeness, it's really hard to comprehend the internals of the library, unless you're the author. If you document its internals, the techniques you use, then it would be great, and other users can also help the development more actively. (Of course, one may read the source code, but its hugeness makes it very hard without such documentation.)

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

I used both the C API and Selene. Of course, Sol2 is much easier to use than C API and it has same easiness level as Selene. (But I must confess that the plain C API is more fun but dangerous.)

Is the documentation or examples helpful?

They are both definitely helpful. But as I stated before, they can be improved.

Anything else about the library you feel like adding or pointing out?

It's just a great library. Thank you.

Murloc992 commented 8 years ago

How did you find out / hear about sol2?

Was just looking through GitHub for a better library than I had that didn't choke on Union-heavy user types

What're you using it for?

A small VR game, just want to test some code easier than just doing some recompiling

What Lua library did you use before you found sol2?

Selene

What do you like about sol2?

It's amazing and not stale so far, very responsive dev.

What do you dislike about sol2?

Nothing at all

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

It's pretty much the same in the difficulty department

Is the documentation or examples helpful?

Yes, it's very nice

Anything else about the library you feel like adding or pointing out?

I will do it if the need arises.

Thank you. :)

OrfeasZ commented 8 years ago

How did you find out / hear about sol2?

I don't exactly remember. I think I was looking for an alternative to luabind, as it was causing several issues for me, when I came across sol2.

What're you using it for?

I'm using sol2 for making data classes and functionality of a game engine available to lua land for a few mods I'm working on, in order to allow users to more easily modify the game via lua.

What Lua library did you use before you found sol2?

I was using luabind (some custom fork, not the latest official one).

What do you like about sol2?

I like that it's pretty straight forward, that it supports the vast amount of features my project requires, and that it's actively developed. Even things that were not supported were very quickly introduced by you.

What do you dislike about sol2?

I will have to agree with @Nava2 here. Compile times can be very long and generated code can also be very large. I understand that this is a trade-off of using template metaprogramming, which generates mostly static code in order to avoid performing operations during runtime, but especially for me, where I have projects with over 3000 generated bindings, it gets pretty insane (10GB+ RAM usage to link, about an hour to compile on 12 threads, 150MB+ output binary (with some optimizations on)). I believe there are some things that are inherently too complex for no reason in sol2's codebase, and can be possibly improved upon by simplifying them.

Secondly, the codebase itself is rather hard to follow for someone that hasn't been actively involved in the project's development from the beginning. During my attempt to implement member inheritance for #157 I was often lost trying to figure out what something does, and the lack of internal documentation in most places doesn't help either. This is more of a minor complaint, but I think that it could be an important step towards getting more people to actively contribute to this project.

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

I would say it's pretty similar to how luabind worked. Some things are definitely easier, while some things were slightly confusing when transitioning. Thankfully, the documentation (and yourself) were very helpful when it came to that.

Is the documentation or examples helpful?

The documentation has improved by orders of magnitude in the past few months. I believe it is now more accessible and more straight forward for people without immediate knowledge of lua or other binding libraries.

Anything else about the library you feel like adding or pointing out?

After my recent shenanigans with #157 I came across a possibly interesting observation, especially after looking at the benchmarks you posted. I think you should evaluate sol2 performance when accessing bound usertypes with a huge number of members that are dynamically indexed (ie. using find_call()), as it might produce different results than expected. I would do so myself, but unfortunately I can't get the lua-bench project to work correctly for me, and it was a massive pain to get it somehow working to evaluate the performance of my fork (which was apparently identical to yours btw).

wtfbbqhax commented 8 years ago

How did you find out / hear about sol2?

I found sol2 recommended in an issue report from jeremyong/Selene project.

What're you using it for?

  • Tremulous is an ioQuake3 Mod created by Darklegion Development but has since been discontinued. Using ThePhD/sol2 I would like to replace the standard in-game quake console with a full featured Lua REPL.
  • Lua support for my extended catalog of C libraries most of which are related to InfoSec.

What Lua library did you use before you found sol2?

Plain C API

What do you like about sol2?

Best documentation I've seen probably ever- Nearly everything has an example, what doesn't shows up as an issue here. Sometimes those issues turn out to be missing/broken functionality, but the pace at which they are fixed is worth a πŸ†.

What do you dislike about sol2?

C++14- Figuring out how to add this to the ioquake3 build system (a massive hand crafted Makefile) and continuing to cross compile all the binaries via Travis is tough 😭.

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

It is easier to use than the Plain C API. It is has better documentation and examples then the plain C API. It is better πŸ‘

Is the documentation or examples helpful?

Yes, thanks!

Anything else about the library you feel like adding or pointing out?

Great Job!

henriquegemignani commented 7 years ago

How did you find out / hear about sol2?

Recomendation from a friend.

What're you using it for?

Most recent use, I wanted to integrate bump.lua into my C++ game. It's not going to be definitive, so I wanted to do something quick.

What Lua library did you use before you found sol2?

Mostly C API directly, sometimes some self-made C++ wrappers, and something else made by my aforementioned friend.

What do you like about sol2?

Treating lua objects as they were C++ objects. Also, header only!

What do you dislike about sol2?

N/A, didn't use too much.

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

Easier.

Is the documentation or examples helpful?

Yes, but somehow I walked in circles for a long before being able to write this:

auto file = file_manager()->OpenFile("bump.lua");
L.require_script("bump", file->GetContents());
L.script("world = bump.newWorld(8)");
collision_body_ = L.create_table_with("name", "Player");
L["world"]["add"](L["world"], collision_body_, position_.x, position_.y, width_, height_);

Not really sure why...

Anything else about the library you feel like adding or pointing out? I'll definitely continue using!

eliasdaler commented 7 years ago

How did you find out / hear about sol2?

Google + some people on twitter (especially Jason Turner :D) recommended it to me.

What're you using it for?

I'm using it for my game called Re:creation

What Lua library did you use before you found sol2?

LuaBridge

What do you like about sol2?

Almost everything. Its interface, capabilities, speed. It has everything I need from the Lua/C++ binding.

What do you dislike about sol2?

  • Compile times. Those are being reduced by recent releases, but I feel like there's still some work that needs to be done about that. :)
  • Some random bugs breaking my game from time to time .Thankfully they're fixed very fast and I understand that maintaining such a huge project is very hard. And it's mostly stable and bugless in most things.
  • Safety being turned off by default. While I undestand that it's important for speed, there should be some important subset of errors which are thrown by the default. Getting a total crash instead of exception is frustrating at times, because you have no indication of what went wrong. And sometimes it's just some simple Lua error, like trying to call a nil value. sol::function vs sol::protected_function is still a not that obvious in my opinion. I guess most people expect functions to have some basic protection being turned on by default and have it turned off in some sol::quick_function or something like that.

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

It's much easier! Binding classes/functions, iterating over tables, creating new tables, handling state, etc. - everything is much easier and neater.

Is the documentation or examples helpful?

Yes, they're pretty great, though maybe some of them should be less abstract. And there are some common things people may need to do being left from documentation (e.g. returning table from script and getting it in C++). But I understand that there's work being done in that direction and I'll be happy to help with this once I have more free time on my hands.

Anything else about the library you feel like adding or pointing out?

Nah! Just keep doing great job @ThePhD, your Lua/C++ binding is the best one in most categories and I hope it gets more users, recognition and praise.

shohnwal commented 7 years ago

How did you find out / hear about sol2?

I googled for methods how to combine C++ and Lua, found that plain C Lua was not compelling and searched for Lua wrappers and decided to take a look at Selene. However for some reason working with it didn't feel comfortable so i looked further and discoverered Sol (Sol1), which was great. After looking for updates i found out that you already released Sol2.

What're you using it for?

My team recently started working on a Ragnarok Online remake/singleplayer spinoff with the UE4 engine and i'll be using Sol2/LuaJit for moddable features like monster databases, item databases, npc scripts, quest scripts, etc.

I will also use it for any other future gaming project or even non-gaming project i'll do where scripting and modding would be useful. Sol2 made C++/Lua interaction really fun for me!

What Lua library did you use before you found sol2?

Selene, Sol1

What do you like about sol2?

I absolutely love -the comfortable syntax, -the many different syntax methods how to access tables -the amount of features it has (class bindings, method bindings, tuple returns) -Sol2 being header only -the speed, of course. Also, i really like how compatible it is with differnt Lua versions and LuaJit. Really great!

What do you dislike about sol2?

Currently my biggest problem is that it's not inherently compatible with Unreal 4 because UE4 only uses C++11 and has macro conflicts with Sol2 (as mentioned in one of my issue tickets) but i can't really blame Sol2 for that.

Other than that, maybe the usage of protected_function is a bit verbose, because you need to first assign a lua function to it, then an error handler needs to be defined, then you have to call it to get an auto object back, then you have to check if it's valid or not and then finally you can use it. I'm not sure if the return value usageit can be shortened, but an optimal usage when creating the function, would probably be something if we could initialize a protected function with two parameters : the first one being the lua function to call and the second being the error handler to call incase something goes wrong.

Currently it works like this:

sol::protected_function problematicwoof = lua["woof"];
problematicwoof.error_handler = lua["got_problems"];

which could be shortened to this: sol::protected_function functionname(<luafunction_to_call>, <lua_error_handler_function>);, or in practical values used by the documentation sol::protected_function problematicwoof (lua["woof"], lua["got_problems"]);, which would reduce the required lines for a protected function from 2 to 1 and we wouldn't have to manually assign the problematicwoof.error_handler with a separate line, much more comfortable and easier to read.

Heck, this could be taken even further by giving sol::state a option for a default error_handler lua function and then every protected function with only one parameter would use the default-ed error_handler:

sol::state lua;
lua.open_file( "somefile_that_contains_error_handler.lua" );
lua.default_error_handler = lua["got_problems"];
sol::protected_function problematicwoof (lua["woof"]); //<<< calls lua.default_error_handler if it fails

But other than that nitpicky stuff i'm very, very happy with Sol2. ^___^

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

I used Selene before Sol2 and for me, absolutely and definitely yes, Sol2 is much more comfortable and easier to use!

Is the documentation or examples helpful?

Absolutely! In the beginning it was a bit sparse but now it's really useful. I haven't read through all of it yet, though, but for the things i needed so far it's sufficient.

Anything else about the library you feel like adding or pointing out?

I like the dedication that is put in this library and the continuous development.

kavika13 commented 7 years ago

How did you find out / hear about sol2?

Coworker at Wolfire Games told me about Sol2 when I was picking a scripting engine for my personal project.

What're you using it for?

Doing a ground-up C++ rebuild of the game engine for https://github.com/kavika13/jumpmanzero - using Lua as the scripting language.

What Lua library did you use before you found sol2?

None of them.

What do you like about sol2?

I'm a big fan of the transparent smart pointer support. I was skeptical, and expecting missed cases, but so far it's worked out well!

There is a lot that looks really promising (and already plenty useful). The syntax and API seem good. The continual attention to performance benchmarking and semantic differences between LUA/C++. The consideration for breaking/non-breaking changes.

The direct, suitably brief, not "RTFM", and non-defensive communication on issues is really great. This is a great example of how to talk to your user base πŸ‘

I love the very human tagging on issues :)

The quick and dirty tutorial and graduating detail pages on C++ support is probably the thing that sold me hardest. Seeing a demo of a usertype front-and-center was the most important thing to me - I was expecting to have to read through those docs more fully before knowing whether I liked that interface or not.

What do you dislike about sol2?

I don't dislike anything, really, but I will describe some of my challenges so far.

The C++ STL container support isn't well documented yet, or if it is, I haven't found it. I've only found closed issues on the topic, and it looks like it is somewhat in flux. I'm trying to draft up an issue to discuss this further, though it's hard to tell the current state of the project and future plans on this topics.

I want to see a roadmap of things you think will need more work going forward. Even if there aren't any explicit milestones on that roadmap, this would still show where you are most interested in feedback, and where people are going to start hitting the fringes of the library.

This probably isn't something you can do much about (I think it might be Lua's problem?), but I am not liking the error messages I'm seeing when doing bone-headed noobish things like accidentally typing some_instance.some_method(xyz) instead of some_instance:some_method(xyz). I see the error thrown from Sol2 code, so maybe there's something that can be done about it. I wouldn't be surprised if it couldn't be solved, though, due to Lua's ability to pass fewer-than-declared parameters to functions...

From the docs (without having a solid grasp on Lua's user type support), I can't tell how far down the chain of user types I have to define things, and what happens down the line if I don't explicitly declare some types I expose as members. I also can't tell what happens if I choose to define only a few members of a user type, and then pass an instance back and forth between Lua and C++. Does it slice? Does Lua just expose an interface to the underlying C++ memory so I don't need to worry about it? What about cases where I return a struct instance (not a pointer to heap), don't explicilty define that user type, and pass that instance to C++ functions/methods/assignment to members?

A clearer and more open support forum might be a good thing. Irc? Slack? ;)

or go on a tangent, really anything

More on the choice of Lua + Sol2 than on Sol2 itself -

I haven't embedded Lua before. I used Lua in World of Warcraft a while back, and knew how it worked since I read most of the language spec back then. Lua looks like it is still the de-facto "standard" for game scripting, it's tiny, and generally pleasant enough to work in.

Squirrel and Angel Script were the other options I considered, and both look interesting. For my first game script embedding project, I wanted to use something that I would spend as little time as possible banging my head on. Application layer boundaries have been the source of ~90% of my google searches in the past 10 years, so I wanted to make sure I was going to find answers.

Sol2 still seems to be quite the work in progress (in the best way). It looks like you're paying plenty of attention to it, and it looks like it is already capable of doing what I need it to do.

billw2012 commented 7 years ago

How did you find out / hear about sol2?

http://lua-users.org/wiki/BindingCodeToLua I think I went through a couple of other C++ bindings quite rapidly before I got to this one (luacppinterface and luawrapper I think). They had limitations this one does not.

What're you using it for?

I little android/pc game engine I am working on. I'm driving UI, game state, and entity logic with lua. Had very little troubles getting consistent behaviour on both (and you fixed every one I had quickly).

What Lua library did you use before you found sol2?

luacppinterface and luawrapper if I recall correctly, but only enough to know they didn't cover all my use cases.

What do you like about sol2?

The support, the extensive features, how well complex things like overloading, properties and special functions are simplified.

What do you dislike about sol2?

How it doesn't exist in a vacuum and I might one day have to use lua api without it.

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

Probably the same for the features from the others that I remember and actually used. I'll put it this way: I haven't so far seen a feature in sol2 that I think could be easier to use.

Is the documentation or examples helpful?

Helpful enough.

Anything else about the library you feel like adding or pointing out?

It's pretty awesome. I guess one thing that makes me slightly uneasy is how complex the library is, and that one day I might have to fix a bug in it myself. I don't think it would be impossible but I haven't seen any docs for how the library itself works (I haven't really looked though, as it hasn't been necessary, and that should indicate how slight my unease is).

adriweb commented 7 years ago

How did you find out / hear about sol2?

Googling around for a C++ Lua binding lib

What're you using it for?

Adding Lua bindings for a TI calculator emulator, so that (hopefully) both the emu core and GUI can be scripted :)

What Lua library did you use before you found sol2?

None (in other things, I've used the plain Lua C API though)

What do you like about sol2?

Very easy to use, and the performance is quite awesome

What do you dislike about sol2?

Well that's probably at least partially my fault for not learning all the new tricks in the book, but I've had a bit of a hard time sometimes understanding the fancy C++14 things going on in the code :)

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

N/A

Is the documentation or examples helpful?

Yep, definitely (especially the examples)

Anything else about the library you feel like adding or pointing out?

Keep up the good work, it really is a great lib!

Strasser-Pablo commented 7 years ago

-How did you find out / hear about sol2? Googling for lua to c++ binding. -What're you using it for? Use torch from c++. Creating a bridge between lua code and c++ code. -What Lua library did you use before you found sol2? None. -What do you like about sol2? Easy to use. -What do you dislike about sol2? Strange compile time error for nested different type table like lua["a"][1]["b"][2] may not work if not casting to sol::table at each step. Need to create the table first a create table if needed would be nice. -Is the documentation or examples helpful? Yes but it miss sometimes an example of use. -Anything else about the library you feel like adding or pointing out? It would be interessting to have a function or class that create a main loop accepting the same argument than a lua interpreter which will allow to easely extend lua functionality without need to write c++ code to read a script and only write code to extend the types.

shultays commented 7 years ago
  • How did you find out / hear about sol2? I think I googled "lua C++ wrappers" and found about sol
  • What're you using it for? I am using it for scripting part of my game
  • What Lua library did you use before you found sol2? I tried it going without any wrapper and it was a big head ache. thanks sol!
  • What do you like about sol2? It is pretty easy to use.
  • What do you dislike about sol2? Sometimes I get lua run time errors without explanations. Compile errors are impossible, but that is kinda expected when it comes to templates.
  • Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this) I tried to use plain C api before, it is definitely easier.
  • Is the documentation or examples helpful? Examples are very useful, honestly I didn't need to check documentation at all, everything I tried to was available with examples.
  • Anything else about the library you feel like adding or pointing out? Would it be possible to add any kind of performance analyzer? How much time I am consuming on lua methods, sol overhead or passing data between C++ and lua would be great.
ThePhD commented 7 years ago

@shultays The most I can do for you is give you sol2's benchmarks compared to other libraries (available in the benchmarks section of the docs). After that, any performance analysis is something you'll have to insert around your code and the like...

shultays commented 7 years ago

@ThePhD That is alright. Mostly I use visual studio performance analyzer tool but it does not work on lua of course. in future I will add remotery to my project and add ability to call it on lua.

anyway, great work! thanks for sol2.

carloscm commented 7 years ago

How did you find out / hear about sol2?

I decided to move from s7 Scheme + my own C++ reflection layer to LuaJIT+l2l + my own reflection layer. I first researched C++ wrappers for Lua before rolling my own, and I discovered sol (mostly by googling), which allows me to avoid writing a large part of the reflection layer (I still use my code to inspect C++ headers and generate the usertype mapping calls).

What're you using it for?

Wrapping the core C++ classes in a videogame to make them available to Lua code.

What Lua library did you use before you found sol2?

None, this is my first Lua project.

What do you like about sol2?

Super natural and easy to use, it just feels right.

What do you dislike about sol2?

std::[unordered_]set had no way to perform a lookup from the Lua side (other than iterating), and I saw in #196 it wasn't desired to have table-like access for lookups, so I added a :find to the container metatable. I've submitted a pull request.

I also have some very particular legacy requirements in the source I'm porting so I had to hack the metatables sol generates for my C++ classes (basically my old scripting system allowed any C++ instance to be extended on the fly with new scripting-side properties, so my newindex and index must lookup a Lua-side table for each instance for possible new fields, then pass control to the sol code). This is not a dislike, more like a resignation on my part, that I will have to follow closely the evolving internals of sol if I want upgrades.

Is the documentation or examples helpful?

They are!

Anything else about the library you feel like adding or pointing out?

I'm probably obsessing too much about performance (I'm still porting, so not doing perf work for now), but I've seen class methods and attributes are indexed by string, like map<string, ...>. I was dreaming on having a Lua-side table for this, to take advantage of the string interning, then instead of passing a string to C++, pass an integer ordinal, for a constant lookup into a vector. I may hack on this in the future if I'm not buried under a landslide of work.

Thank you for sol, it's top notch work!

bditt commented 7 years ago

How did you find out / hear about sol2? Was looking for Lua Wrapper in C++ on GitHub. What're you using it for? As a VM frame work. What Lua library did you use before you found sol2? Just lua 5.1.5 vanilla for the Lua C API. What do you like about sol2? I was actually able to get it to work. Tried LuWra first but couldn't get it to work. What do you dislike about sol2? It's a little hard for me to understand. Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this) I found the plain C API easier but very limited compared to this. Is the documentation or examples helpful? Not really. They didn't show me what I needed to know. Anything else about the library you feel like adding or pointing out? Can you make some examples on how to use C API in this. I'm having a hard time figuring that out.

If you wouldn't mind, it would be great if you can add me on discord. My discord: bditt#0327 I really like this but I find it kinda confusing. Thanks for producing this. <3

IamTheCarl commented 7 years ago

How did you find out / hear about sol2? I honestly don't know. I had been looking for a C++/Lua integration library, but do not remember across Sol. Then one day I was cleaning up my tabs and found one opened to Sol. There was no history to the tab, so I'm guessing I did the "Open in new tab" thing and forgot about it.

What're you using it for? I've been working on a video game. It requires some really heavy optimization, so I've been writing my own engine in C++. The Unreal engine might be able to suit my needs, but meh.

What Lua library did you use before you found sol2? I tried out LuaBind, but that thing is a serious pain in the butt to compile. Boost is a great idea, and I use it, but I personally feel like they really over complicated that project. I've also used LuaJ. Your library is easier to use than that one.

What do you like about sol2? Being a header only library, it's super easy to cross compile, which is something I do. It's also very intuitive and has excellent documentation. I mean really, your documentation is worthy of an A+.

What do you dislike about sol2? I've had some trouble getting it to play nicely with the Boost filesystem library. Even with sol::resolve, it just can't figure out which overloaded function I'm trying to get from the path class. I honestly don't know if it's an issue with sol, boost, or if I'm just doing it wrong. It works right with other classes, so I think it's one of the APIs causing the issue.

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this) I've used the C API before, and I've also used LuaJ, but this one has proven to be the easiest one to use.

Is the documentation or examples helpful? This is some of the best documentation I've had the pleasure of reading.

Anything else about the library you feel like adding or pointing out? It's very useful to be able to define classes in C++ and make them available in Lua, but it would also be very helpful to have the power to define classes in Lua that are derived from a C++ class. For example, I would like to define base GUI elements in the C++ side and then let Lua extend them to make custom GUI elements. I'm okay if we have to extend a bunch of functions/add a bunch of stuff to the class intended to be extended to make this work, but only if we have to. I'm actually contemplating contributing to this project to add a feature like that.

mrgreywater commented 7 years ago

How did you find out / hear about sol2? What Lua library did you use before you found sol2?

What do you like about sol2?

What do you dislike about sol2?

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

Is the documentation or examples helpful?

Anything else about the library you feel like adding or pointing out?

adriweb commented 7 years ago

@mrgreywater I've had the same "issue" about the .new(), you can customize that with sol::call_constructor, see the messages below in the comments I've linked.

ThePhD commented 7 years ago

@mrgreywater Thanks for your interest in sol2. I'll try my best to answer your question, and also redirect to new issues I'll open up in case our framework doesn't cover something.

sagamusix commented 7 years ago

Okay, I'm one week into this drug so I think it's time to give some feedback.

How did you find out / hear about sol2?

http://lua-users.org/wiki/BindingCodeToLua (totally should be at the top of that list!)

What're you using it for?

Adding a scripting API to my long-time sparetime project OpenMPT.

What Lua library did you use before you found sol2?

The idea of adding scripting to that application came up in about 2010, at which time I was still trying to roll my own abstractions from the Lua C API. Then later I decided to use Squirrel (with the Sqrat wrapper) instead, and now I'm back to Lua after considering that it just has the better (more alive) ecosystem (like this wrapper). We only recently dropped support for compilers older than VS2015, and now I have one more reason to be glad about that change.

What do you like about sol2?

What do you dislike about sol2?

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

Definitely easier than the C API, and if the comparison is allowed, also easier than the Squirrel bindings I've tried.

Is the documentation or examples helpful?

Mostly yes, and when there's something that's missing, I've already seen that you will add it basically at light-speed. ;)

Anything else about the library you feel like adding or pointing out?

Thanks for the continued maintenance!

ThePhD commented 7 years ago

@mrgreywater I've pushed some new stuff that adds some ease-of-use for some of your concerns (except for the string handling). You can see it in the new docs:

http://sol2.readthedocs.io/en/latest/api/as_returns.html http://sol2.readthedocs.io/en/latest/api/variadic_results.html

That should help you get very far. For the string thing, see the advice here: https://github.com/ThePhD/sol2/issues/442

Good luck!

Koncord commented 7 years ago

How did you find out / hear about sol2? Found here: http://lua-users.org/wiki/BindingCodeToLua What're you using it for? New scripting API for TES3MP What Lua library did you use before you found sol2? LuaBridge What do you like about sol2? Ease of use. C++11 and C++14 support. What do you dislike about sol2? Payment for head-only (Compilation time) Is the documentation or examples helpful? Helps a lot Anything else about the library you feel like adding or pointing out? Would be nice if you add terra compatible layer

ThePhD commented 7 years ago

@Koncord What's a "terra compatible layer", exactly? Where you can make sol2 speak to all of Terra...?

denesb commented 6 years ago

How did you find out / hear about sol2?

Don't remember exactly, some blog post, possibly eliasdaler's

What're you using it for?

A hobby game project.

What Lua library did you use before you found sol2?

None

What do you like about sol2?

It is really convenient to use.

What do you dislike about sol2?

Nothing comes to mind.

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

N/A

Is the documentation or examples helpful?

Yes, the documentation is first-class and the examples are useful as well. So far I found everything I was looking for.

Anything else about the library you feel like adding or pointing out?

I love how it exploits modern C++ meta programming to generate the binding code. Feels like knowing how the Lua C API works is a prerequisite. Not that this is a problem, after all this is a Lua bindings project. Maybe add a note about that and a link to the relevant chapters of the Lua book. :)

bditt commented 6 years ago

Questions:

  1. How did you find out / hear about sol2?
  2. What're you using it for?
  3. What Lua library did you use before you found sol2?
  4. What do you like about sol2?
  5. What do you dislike about sol2?
  6. Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)
  7. Is the documentation or examples helpful?
  8. Anything else about the library you feel like adding or pointing out?

Answers:

  1. Searching Github for a lua wrapper.
  2. I use it as a reference guide by studying the code and try to make my own version that will work with my functions.
  3. I only used the vanilla Lua 5.1 library before learning of Sol2.
  4. I like how easy it is to use Sol2 along with it being open source.
  5. That I can't get it to actually be compatible with my project but that's only because the problem is on my side. Not Sol2. Besides that, nothing. @ThePhD, fixes any problems that arises pretty fast if he is able to.
  6. It makes it easier because it makes ideas seem more possible because the functions from Sol2 gives you ideas.
  7. Yes, they are helpful but could be a little more in-depth.
  8. The library is pretty great in general and I just wish I use it in a few of my projects. Glad I use it.
RussellHaley commented 6 years ago

How did you find out / hear about sol2?

You had mentioned it on the lua-l list. I found your presentation on the LuaWorkshop and "just had to have it".

What're you using it for?

The lua C API really turns me off. I started using Lua to make my life in C easier, not harder. Having to manage a stack is the opposite of what I wanted. I have been really depressed about that for a while now.

What Lua library did you use before you found sol2?

I've tried some of the .Net lua wrappers. Very leaky and not great. I could see building a .Net package off of sol2 as being a far better option.

What do you like about sol2?

Still new. I got it to compile into my qt sample app in 26 minutes! (And I promise you my C++ skills are not going to impress anyone). I've been trying to learn "pure lua" and was very hesitant to walk away from that (even though I don't like the C API). You're presentation is the first thing to convince me there is a better way.

What do you dislike about sol2?

TBD

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

I'm avoiding the C API like the plague. I keep piking up PIL and putting it back down... lol

Is the documentation or examples helpful?

TBD. The 2016 workshop presentation was excellent.

Anything else about the library you feel like adding or pointing out?

Thank you thank you thank you thank you thank you thank you thank you thank you!

DatCaptainHorse commented 6 years ago
RussellHaley commented 6 years ago

Hi, The speed and deftness with which you respond to open tickets is amazing, but your proclivity to close issues after your response feels like it cuts conversations short. It may be worth while setting up a means for users to communicate and share? Cheers, and thanks for you hard work.

ThePhD commented 6 years ago

@RussellHaley https://gitter.im/chat-sol2/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

It's no mailing list and it's actually not the BEST of all the electron-based chat apps, but... it gets the job done! I do apologize for quickly closing issues: I don't quite use them as good as other people do, or for their intended purpose. I'm sorry if it feels like I'm cutting things short: but I'm more than happy to keep replying in closed issues if things don't quite pan out fully.

RussellHaley commented 6 years ago

And you have gone to great lengths accommodating me in closed issues, for which I am grateful. Gitter will be fine for my purposes. See you soon. πŸ‘

NullCascade commented 6 years ago

How did you find out / hear about sol2?

I think the first place I heard of it was from http://lua-users.org/wiki/BindingCodeToLua

What're you using it for?

The Morrowind Script Extender will be using it (on top of LuaJIT) for its expanded scripting language in its next version. I am binding reverse engineered structures and exposing native functions to get away from the hell that is Morrowind's normal scripting VM.

What Lua library did you use before you found sol2?

I've not used any other Lua library before sol2, other briefly testing a few others. Professionally I've used Lua while working at Corona Labs.

What do you like about sol2?

Everything is dead simple. Manipulating the stack is fun the first time, but I'd rather just get up and go.

What do you dislike about sol2?

Having to learn the "sol2" way to do things can be annoying, but the docs have helped. So far the only issue I've had is binding (non-std) arrays. That isn't always viable, because I don't get to control the underlying structures viably.

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

N/A

Is the documentation or examples helpful?

They are, but they aren't always complete. For example, I couldn't find documentation for state.create_table(narr, nrec); easily and had to just go off of variable names/tests.

Anything else about the library you feel like adding or pointing out?

I'm sure I'll find something eventually, and will use the chat room/issues here to bring it up.

JoshKlint commented 6 years ago

How did you find out / hear about sol2?

Googled for the terms "lua", "shared_ptr".

What're you using it for?

Evaluating for use in Leadwerks Game Engine 5

What Lua library did you use before you found sol2?

tolua++

What do you like about sol2?

Support for shared pointers, very flexible and lets me tune the API to deliver the Lua user experience I want, have not yet found something I could not do with it. Speed is also a big benefit. The ease with which you can expose a new function or class is awesome.

What do you dislike about sol2?

No support for default arguments, necessity to hand-write entire binding code, and shared_ptr support is a bit wonky in places. However, this can be alleviated with a custom header parser once I figure out how everything works.

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

Harder than tolua++ but the increased flexibility is worth it.

Is the documentation or examples helpful?

Yes, but a lot of it is over my head.

Anything else about the library you feel like adding or pointing out?

Not done evaluating it but do far it looks like the best Lua binding library I have ever used.

noresources commented 6 years ago

I am not currently using sol2 but looking for a good lua binder for an existing game engine / system daemon

What're you using it for?

running lua scripts to interact with C++ code instead of writing pure C++ plugins

What Lua library did you use before you found sol2?

In a previous project, a completely home made solution. Something which I definitely don't want to reproduce in the new project.

What do you like about sol2?

Seems straight forward, powerful and does not require a lot of code to do something. Everything I need.

What do you dislike about sol2?

The very high compiler requirements of sol2. When I started to monitor this project, it requires C++11 and it was already a negative point to me. Now I am unable to compile tests on most of platform I am using and I see that sol3 will require even newer compiler. I consider compile time performance as the least significant problem, especially if it's at the expense of other concerns like portability.

ka0s420 commented 6 years ago

How did you find out / hear about sol2? Can't remember exactly, it was in the comments of a blog post tutorial for lua bind possibly. The author of the article had replied to someone saying sol2 is better, forget luabind (lol).

What're you using it for? It's part of a bundle of super cool libraries I'm using in my game engine project. Its a simplish, 2d tiled based engine. I'm using Sol2, Cereal, Dear Imgui and SFML - to think I used to be afraid of libraries, yours and the others on this list have changed that outlook somewhat ;)

What Lua library did you use before you found sol2? I've tried a few things, not all lua based. I've used pybind 11, luabind, chaiscript and others that I can't remember. I was actually at the point of giving up on the idea of embedding a scripting language, and that's when i found sol2. Those other were either too complicated,, or slow or as in chaiscript had very little documentation.

What do you like about sol2?

Seems pretty easy to use, very little boiler plate, good documentation, reassuringly prompt and professional developer behind it who seems passionate about the library, single header and fast!

What do you dislike about sol2?

There are still certain things about it that are a bit mystical or over my head, but I've only been using it a week now. Like someone else mentioned, a forum or something would be good for users to help each other. I see that you responded to a similar comment earlier, about a gitter, but still, I wouldn't have known about it without having read that comment. Whenever I'm googling to try and work out sol related stuff, it's usually the docs or github that come up in the search, I haven't seen any community results pop up. And I didn't notice it advertised anywhere on the docs, though that could be my own lack of attention.

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

very much easier. See my comment above about lack of boiler plate and such. It mostly just feels like Im accessing a lot of really flexible std::map data that's partially heterogeneous.

Is the documentation or examples helpful?

Yes, the docs are helpful. They're miles ahead of a lot of documentation out there. Some of it is a little unclear though. Like, at the moment, I'm trying to figure out how to return a tuple to lua to access in lua, but the docs about returning data to lua only show it being accessed inside of c++. I might try and find this gitter and ask about it on there.

Anything else about the library you feel like adding or pointing out?

Colour me subjective, but it's just damn sexy ;) It feels native and like it's oriented with the user in mind. Its also always nice to have an idea of who's behind a library, and I very much enjoyed the videos on youtube of your talks etc.

xzores commented 5 years ago

Is the documentation or examples helpful? yes, I would personally like to see some more example on differed lua_states and communication between them

Anything else about the library you feel like adding or pointing out? it is great!

kdudnyk commented 5 years ago

How did you find out / hear about sol2

Saw your talk on cppcon :-)

What're you using it for?

Game engine, code-parsing and automatic lua binding

What Lua library did you use before you found sol2?

LuaBridge, SWIG

What do you like about sol2?

Simplicity and speed

What do you dislike about sol2?

Sometimes it is a little bit annoying to write the boilerplate code, but i know that without reflection there is not that much you can do :(

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

Much better

Is the documentation or examples helpful?

For Sure!

Anything else about the library you feel like adding or pointing out?

While meta-classes or reflection is on the way - I'd like to suggest implementing some binding generator. It shall be relatively easy to use libclang + python to wrap the least complex libraries. ( I've took a liberty of making a really basic and simple PoC at https://github.com/kdudnyk/LuaSol3Generator )

TheAifam5 commented 5 years ago

@kdudnyk You can use RTTR, then iterate all reflections and bind to sol ;)

playmer commented 5 years ago

@TheAifam5 have you done this (RTTR -> Sol)? I'm curious about seeing a sample of something like that. Sorry if it's a bother!

TheAifam5 commented 5 years ago

@playmer kinda.... writing something else for now. Can’t find a good IDE πŸ˜‚ I will report back to you when I’m done writing a profile manager for VSCode :D

kdudnyk commented 5 years ago

@TheAifam5 I am not sure how RTTR will help if i'd like to bind an external library with sol2. As far as i understand i would still need to write a lot of boiler plate - just to get started ( or there is already something automagic available ?) Instead by using an code-generator i can automatically generate sol bindings ( just by a blink of an eye ) and include generated library into my project.

I've already create a very limited script, so you can find an example at https://github.com/kdudnyk/LuaSol3Generator/tree/master/example/Box2D All files that are "Bind_*" - are generated, - and just by that - i am able to run an "hello world" sample of box2d in lua - without writing a single line of wrapping

@ThePhD sorry for spamming here - i am just curious whatever you have any plans to automate boiler plate generation ? If yes - i would be glad to help

ThePhD commented 5 years ago

@kdudnyk I have no plans on writing external binding generators. In most cases people already have a generator in mind (e.g., UnrealHeaderTool) and have custom logic (e.g., this these things should be properties, these things shouldn't be, and so on so forth...).

If I write one, I have to support everyone's use case. If you write one... well, you only have to support you, your syntax, your coding guidelines / styles, and what you want.

In short: reward / effort ratio is waaaaaaaaay less than even 0.1 here. With C++ reflection I'll only have to write this once, and everyone else can go nuts.

fwjavox commented 4 years ago

How did you find out / hear about sol2?

Googled for LUA / C++ integration

What're you using it for?

Scripting in user role management system (some sort of hybrid RBAC/ABAC)

What Lua library did you use before you found sol2?

Plain LUA C API

What do you like about sol2?

It uses modern C++ features so you need just a few lines of code to solve complex problems. It also helps to avoid lots of duplicate code that is neede when using the LUA C API directly.

What do you dislike about sol2?

RAM usage while compiling is immense. I have 32GB installed and have to compile with make -j1 because I run out of memory otherwise. We have complex objects with many fields. I did read the FAQ about this but it didn't help too much.

Is the documentation or examples helpful?

Yes! Both are very good.

Anything else about the library you feel like adding or pointing out?

On this page it says: This is due to C++11 and C++14 not having very good facilities for handling template parameters and variadic template parameters. There are a few things in cutting-edge C++17 and C++Next that sol can use

Is there any ETA on when the transition will happen? This could possibly help a lot with the compile time and RAM usage isses.

nefethael commented 4 years ago

How did you find out / hear about sol2?

Google search for C++14 Lua wrapper

What're you using it for?

Make a flexible microservice with C++ framework backend

What Lua library did you use before you found sol2?

None

What do you like about sol2?

It's great integration with new C++ features (lambda, ...)

What do you dislike about sol2?

None

Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

N/A

Is the documentation or examples helpful?

Great documentation & examples

Anything else about the library you feel like adding or pointing out?

Can't use last version as it needs C++17

RealmRPGer commented 4 years ago
  • How did you find out / hear about sol2?

I did a specific search for lua c++ wrappers and happened upon it. (A few years earlier I had done a similar search but failed to find sol2 at that time)

  • What're you using it for?

We originally started using sol2 for the scripting side of our menu system. I had wanted a scripting language that could easily bind c++ classes, but the language we were using before finding sol2 wound up being far too slow and was causing slowdowns after just 30+ menu items.

Since then, we're also using sol2 as a game object scripting system. Lua's coroutine support allows for scripting things in a task-like manner -- self:WalkToThing() self:PickupThing() can be turned into a coroutine that iterates one step every frame. (C++'s coroutine implementation unfortunately falls short). We'd previously been using lua for just this purpose, but it was plain lua and I begrudged the lack of support for binding c++ classes.

  • What Lua library did you use before you found sol2?

We used vanilla Lua.

  • What do you like about sol2?

As previously mentioned, the ability to directly bind c++ classes and functions is much appreciated. It's also nice that we can send over various object types to lua functions without having to cast -- it requires a little bit of work and c++ templating to get working properly, but is nice once flowing correctly.

  • What do you dislike about sol2?

Right now sol2 takes a hefty chunk of time to compile object bindings. We're mapping most of our classes to sol2, so there is admittedly a lot of them, but it still feels like it takes a comparitively long amount of time considering the comparitively few bindings (18 usertypes with a total of ~100 bindings = 20-30 second compile time).

  • Is it easier or harder from the last Lua library you used? (If you did use a library or the plain C API before this)

Certainly far easier than vanilla lua. I'd say it's also easier to use than the scripting language we used before sol2, which was a language specifically built for c++ bindings, haha.

It is fairly helpful, though I do find myself running into numerous cases not explicitly mentioned in the documentation.

  • Anything else about the library you feel like adding or pointing out?

I've had difficulty with calling unnamed/sol::function functions with state_views. I'm not sure if this is possible or I'm just doing it wrong, but the documentation doesn't have this use case.

ThePhD commented 4 years ago

@RealmRPGer If you can elaborate on the "unnamed/sol::function functions with state_views" in a new issue, I'd be happy to figure out what to do to help!