I'll propose my
Minimal scripting language. Its very simple and a good starting point for making your own scripting language (the code is hopefully easy to follow and its just a pair of .c and .h files). Personally i use it as a starting point for game/engine-specific scripting languages or configuration files so the Minimal lang itself doesn't have much stuff.
At this point I'm probably looking for something a bit more established and documented, with concrete examples, and no need for a great deal of additional work. This is not to disparage your work *at* *all*. It just might not be suited to what I am looking at doing at this point. However, if it came down to rolling my own, I'd be looking around at other people's work, and something with a minimal starting point as you have developed would have a great deal of appeal in such a situation.
Out of curiosity, does it handle the A->B->A stuff I've mentioned, ie. call the script from say C++, and the script can call back?
Another option is AngelScript which can use C++ functions and classes directly and i think even extend them.
This looks interesting- seems like it is designed from scratch to do just what I am describing, and from the doco I *think* it handles the extending/A->B->A stuff I've mentioned. Very interesting.
What aspects in particular rubbed you the wrong way? I'd be interested to hear more about your experiences integrating and using it in your game. Such accounts are pretty hard to come by, and I'm quite curious to hear how things play out for other developers.
I'd made notes somewhere- can't find the cursed things though. Here are a few things off the top of my head, forgive any rustiness, it's been a few years:
- Manually managing the stack is a pain. This makes A->B->A-style extended calls rather painful to work with. They work, but they're a pain.
- Arrays aren't *really* arrays, they're basically maps.
- Arrays begin at 1. Kind of. But not.
- Numbers are actually floats, no separate int type. Justification talks about how floats won't always lose precision, but sometimes you just want an int to be an int.
- Language itself is a bit unwieldy. Some clever things are possible, but it feels more like you are *fighting* the language than *using* it. I ended up simplifying my use of it considerably because it just became too frustrating.
- The API has a nasty habit of changing. The calls that worked for you yesterday may break or refuse to compile when you upgrade. Backward compatibility doesn't seem to be a concern- at least one upgrade *could* have been done with backward-compatible wrappers.. but it wasn't! The "offending" functions were just removed.
- Despite a decent amount of documentation, there tend to be a few ways to do various value manipulation, but it's never clear what the *right* way is. Guess wrong, and the next upgrade will kill your code. Again.
- Weird implementation decisions, such as it being decided that it was actually acceptable to call exit() in an embedded scripting application.
I'd like to emphasise to any LUA fans that these are just my personal experience, and that I'm not looking to debate/argue its merits or hurt anyone's feelings. It just didn't suit my needs, sorry.
I would still always recommend looking at it. It is a well-established embedded scripting language. Some of the problems mentioned above may have been addressed since.
I know what you mean... at first LUA looks like the end all solution, untill you learn the catch is that you have to to a bunch of stack work to pass data to and from it (which its website actually lists as a benefit of the language for some reason.)
And a few more reasons given above.
Yeah, agreed. It's a bit of a letdown as it seems to be the perfect solution before you begin.
I think I'll still end up going with LUA though, I'll just have to go down the twisty road of keeping all my game specific data inside LUA. Actually, I was just thinking about making an Interpreter class to interface all the LUA in C++, but that's still a bit further down the development road.
I'd definitely look into writing a A->B->A-style callback function into your code, unless you want to be stuck either putting everything or nothing into LUA. If need be, just write one or two interface functions, and use the args to go off and do useful things, rather than writing a thick interface. LUA is definitely capable of doing such things, even if it is a bit painful.
Personally, I think that once a library or language starts significantly impacting on your design, then there is a problem, either with the library/language, or how you're using it. A good library or language simplifies what you are doing. A bad one changes it. IMHO!
I have yet to check out python. I've been learning the language to help a friend get into programming and it looks usable, but I haven't taken a look at the C api yet. I also don't think the language itself is as elegant as LUA (for scripting at least), but that would be moot if its implementation into C was better (i.e. shared variables).
Python is a good language, it's one of the reasons I was willing to gamble some time on getting it going as an embedded scripting language even though it wasn't really designed for that purpose specifically. Personally, my preferred language is Ruby, but after some horrible experiences and masses of wasted time trying to get it working as an embedded scripting language, I doubt that I'll try it again.
If you prefer LUA scripting over Python, you might prefer LUA overall, for while the API is painful at times, and changes, it's designed to specifically fit the embedded scripting role. I happen to prefer Python over LUA as a language, myself.
I know there is also SWIG, but meh...
SWIG is definitely worth playing with. Whilst I'm not using it for the embedded scripting, I have used it for creating Ruby modules that use some of my C++ libraries. It is very useful.