Jump to content


Photo

Lua Interpreter


    2 replies to this topic

    #1 AbsoluteXzeroX

    AbsoluteXzeroX

      Newbie

    • Members
    • Pip
    • 3 posts

      Posted 04 November 2016 - 08:14 AM

      I am making an application where I am embedding Lua as a scripting language. Currently I am using MoonSharp to do this, but I was wondering what Windower was using. I noticed some syntax differences around calling a function on an undefined variable. For MoonSharp and even the demo Lua website https://www.lua.org/cgi-bin/demo the following syntax fails   

       

      print( "%s":format(tostring(3)) )
      

      but this code works fine in a Windower addon.

       

      if I add parenthesis around the undeclared variable it works fine

      print( ("%s"):format(tostring(3)) ) 

      So I was just wondering if this is because of the Lua interpreter Windower is using, or if there is some quick way to change my sandbox?

       

       

       



      #2 sdahlka

      sdahlka

        Advanced Member

      • Members
      • PipPipPip
      • 324 posts

        Posted 05 November 2016 - 02:47 PM

        the only thing i can guess is windower uses a custom Lua interpreter



        #3 Iryoku

        Iryoku

          Advanced Member

        • Windower Staff
        • 488 posts

          Posted 09 November 2016 - 02:58 PM

          Arcon made a few changes to the parser (the change you mentioned, and a unary + operator with a matching __unp metamethod), but otherwise it's vanilla PUC-Lua 5.1.5. Both of the changes he made are going away in the next major version of Windower, since we've switched to LuaJIT.

           

          We do not use any sort of binding library; we use the Lua/C API directly.






          1 user(s) are reading this topic

          0 members, 1 guests, 0 anonymous users