Alternatives to Lua

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Alternatives to Lua

      Just wondering (and to improve my programming knowledge overall) are there any other great alternatives to Lua other than Python or making your own scripting language? I'm not personally found of the concept of metatables. And what are some good C/C++ libraries for the alternative(s)?


      And by the way, I'm REALLY enjoying the book, I'm on the Physics Chapter! Can't wait till 5th edition!
      "I'm here to kick ass and chew bubble gum and I'm all out of gum."- Duke Nukem

      The post was edited 1 time, last by ZeroXen ().

    • I havent used it as I like Lua, but check out V8
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz
    • Lua is probably the most common in the games industry. You can check out the python C API, which is pretty simple. C# is another alternative using Mono (which is what unity does). The biggest problems with these two languages (and others) is speed & memory.

      -Rez
    • It is also notable that there are also Lua inspired languages such as Squirrel, which are similar to Lua but have other advantages/disadvantages. I looked into Squirrel for my next project however I am going to stick with Lua.
      PC - Custom Built
      CPU: 3rd Gen. Intel i7 3770 3.4Ghz
      GPU: ATI Radeon HD 7959 3GB
      RAM: 16GB

      Laptop - Alienware M17x
      CPU: 3rd Gen. Intel i7 - Ivy Bridge
      GPU: NVIDIA GeForce GTX 660M - 2GB GDDR5
      RAM: 8GB Dual Channel DDR3 @ 1600mhz
    • Thanks everyone for the suggestions, and I've finally come to a conclusion, Lua. I looked at each language and compared their differences, and for my needs; I've found that Lua suits them. Meaning that I have to overcome my hate for metatables.
      "I'm here to kick ass and chew bubble gum and I'm all out of gum."- Duke Nukem
    • Lua has a lot of shortcomings, but metatables are considered one of the best features of lua. They allow you to change the behavior of the language and are largely responsible for the extendability of lua. What don't you like about metatables?

      -Rez
    • Well, metatables do extend the capabilities of Lua; I found metatables(as a concept) a bit puzzling. Though I do understand what they did in Chapter 12, communication of Lua and C++. I do not know what else they can be used for. If you could tell me what else they could be used for( just a few examples) then maybe I can have a change of heart. Maybe I exaggerated, I don't hate them, it's just I don't know their use.
      "I'm here to kick ass and chew bubble gum and I'm all out of gum."- Duke Nukem
    • Metatables don't really have anything to do with C++ communication. They are a way of overloading functionality. A metatable is just like any other table in Lua (in fact, any table can be used as a metatable). There are a number of special members inside a metatable that cause it to change the behavior of the table it's attached to.

      Metatables are the trickiest concept to understand in Lua. They're not really required to use Lua, but they definitely help. Still, I would make sure that you're comfortable with the core concepts in Lua and especially table manipulation before you dig into metatables. Once you're ready, you read up on metatables either from Game Coding Complete or from other sources.

      Here's a simple tutorial for how metatables work:
      nova-fusion.com/2011/06/30/lua-metatables-tutorial/

      You can also read this chapter on metatables from Programming in Lua:
      lua.org/pil/13.html

      Both of these are great resources for learning about metatables.

      -Rez
    • For me I'm looking for a scripting language thats fast. Thats more important than features to me (Within reason).

      How fast are these scripting languages in comparison to a compiled language such as C++ or a JIT language such as Java (Not Javascript)?

      I wrote my own high performance scripting language back in 1999 for the telecoms company I was working for. It would have to process hundreds of incoming telephony events every second. But still it was no way near as fast as native C++ code... I'm kind of hoping that scripting languages have improved a lot since then.

      Thanks
      Ben
    • It really depends on what you're trying to do. We did some comparisons of Python to C++ a while back and some surprising things were really slow while other things were extremely fast. C++ was always the fastest in every case by at least double (usually closer to 10x). Your best bet is to write some comparison tests and test it all out.

      That having been said, I've always been happy with Lua. It's very fast for a scripting language and very light-weight in memory usage. It can be painfully slow to call into Lua from C++, but calling C++ functions from Lua is lightning fast, making it very easy to optimize certain parts of your project by moving functions to C++. This is my general strategy, along with not "ticking" Lua. In other words, I don't have a bunch of Lua Update() functions that are run every frame, it's all event driven.

      -Rez