• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Lua, a fast, powerful and lightweight scripting language

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Lua, a fast, powerful and lightweight scripting language

    'tis sunny here, but if it turns into a wet weekend, you might like to get your head around Lua.

    The Lua programming language is a fast, powerful and lightweight scripting language, and implementations of Lua are available on many operating system platforms.

    You might be using it even if you've never heard of it, as it's in many games, Logitech keyboards and Adobe Photoshop Lightroom.

    See lists of uses here.

    Roberto Ierusalimschy (author of Lua) in a Stanford lecture (just over an hour long, then a question and answer session); Lua - tradeoffs and designs and comparisons.

    More lectures and papers available at the chap's website.
    Behold the warranty -- the bold print giveth and the fine print taketh away.

    #2
    Do we need yet more scripting languages? Already we have php, ruby, python etc.

    I am more interested in innovative new compiled languages. Yet to try out F# though.
    Vote Corbyn ! Save this country !

    Comment


      #3
      That's what I thought until I saw the number of applications using it. Lua has actually been kicking around for a while now.
      Last edited by Sysman; 2 April 2010, 15:34.
      Behold the warranty -- the bold print giveth and the fine print taketh away.

      Comment


        #4
        It looks extremely similar to JavaScript (which it pre-dates) - in fact, most of the example code snippets on the Wikipedia page would be valid JS with the addition of nothing more than ()s, {}s and ;s and would function identically, particularly the ones relating to closures and lambdas. Also, the table data structure seems to be pretty much identical in both syntax and behaviour to JavaScript object literals.

        ...And indeed, Brendan Eich (who created JS) speaks well of Lua when responding to some comments about it on his blog.

        Comment


          #5
          Now there's an interesting thought. Learn one of them and you have a good foundation for the other.

          It sounds a pretty good way to kill two birds with one stone, and beef up the CV in the process
          Last edited by Sysman; 2 April 2010, 18:12.
          Behold the warranty -- the bold print giveth and the fine print taketh away.

          Comment


            #6
            Originally posted by Sysman View Post
            Now there's an interesting thought. Learn one of them and you have a good foundation for the other.

            It sounds a pretty good way to kill two birds with one stone, and beef up the CV in the process
            Indeed; and by starting with Lua, you'd learn all the correct techniques to then use with JS (such as lambdas, closures, functional programming, and object literals), rather than all that unfortunate "Let's pretend it's a baby Java" rubbish that still clutters the majority of JS tutorials out there

            Comment


              #7
              Lua's been around ages. It's actually used quite a lot in games software.
              One of the advantages is that many languages have Lua interpreters, so for instance in the gaming world your C++ app creats a Lua object and can call methods, which can access C++ data, etc.
              Until fairly recently, JS didn't do this but there are now at least a couple of widely used JS engines that work the same.
              Originally posted by MaryPoppins
              I'd still not breastfeed a nazi
              Originally posted by vetran
              Urine is quite nourishing

              Comment


                #8
                Originally posted by d000hg View Post
                Until fairly recently, JS didn't do this but there are now at least a couple of widely used JS engines that work the same.
                Not quite correct: I used to write server-side JavaScript in 1997 on Netscape's LiveWire web server. The server object model was pretty similar to the one that MS later came up with for ASP. So even in the early days of JS (this was when Netscape Navigator 3 was the best browser) there was at least one implementation of JS that wasn't tied to the browser.

                MS's JScript has, since IE 4 (maybe since IE 3.02, thinking about it), been a COM-based scripting engine adhering to the Windows API for such things, and therefore not only usable in Windows Script Host for shell scripts but also able to be integrated with any Windows-based application that wants a scripting language. Unfortunately, most of them have tended to stick with integrating VBScript, even though integrating one means you can (in principle) integrate them all - even PerlScript, although I don't know if that's still a going concern.

                Although he now works on developing the next version of C#, Eric Lippert's blog Fabulous Adventures in Coding is a veritable treasure trove of information on the Windows scripting engines.

                Oh, and he once posted some really useful info about IE 3's version of JS on comp.lang.javascript, and then had the good grace to respond to my rather snotty response with an apology for the original problem. I've been embarrassed about my attitude in that question to him ever since

                Comment


                  #9
                  Originally posted by NickFitz View Post
                  MS's JScript has, since IE 4 (maybe since IE 3.02, thinking about it), been a COM-based scripting engine adhering to the Windows API for such things, and therefore not only usable in Windows Script Host for shell scripts but also able to be integrated with any Windows-based application that wants a scripting language.
                  WHS. I used it in a couple of applications, and I think it was around before WSH. ASP was just an application that used that same script engine.

                  Plan B Code has a whole ECMAScript interpreter and runtime wrtten in C++, which unfortunately I didn't get to write but have optimised and added to since. So it means I know quite a bit about JavaScript, the language, but at the same time little about Javascript as it's commonly used - i.e. in a browser. Try explaining that to agents.

                  Seeing the description of Lua, it does look like JavaScript was a C syntax version of Lua. Though given that this is now the 21st century, I don't think anybody should be focusing too much effort on either.
                  Will work inside IR35. Or for food.

                  Comment

                  Working...
                  X