Lua for MorphOS dirty preview v1
  • MorphOS Developer
    Krashan
    Posts: 1107 from 2003/6/11
    From: Białystok...
    Lua is one of modern scripting languages. It is highly portable so compiling the interpreter and basic commandline tools included in the package is a matter of ./configure; make. Usefulness of such a fast port is limited however. Encounaged by the language portability, compactness and elegance I've tried to make some more integrated port. The first results are available here for a public review.

    The interpreter itself has been packed into a shared MorphOS library called lua.library. The library is small, it has less than 140 kB. The complete language "C API" is exposed, including debug one. The interpreter is barebone however, it means all the standard libraries are excluded for now. I'm going to tweak the Lua package manager to handle C packages as MorphOS shared libraries too. Then all the standard (and extra) libraries will be dynamically loaded on-demand.

    A unique feature of MorphOS Lua package is Lua Explorador. It is written from scratch, MUI-based source level debugger using Lua debug API. While not yet complete, it allows for loading a script from file, view the source, run it in a single-step mode, watching all local and global variables, Lua stack and call history. Lua Explorador uses a (private for now) MUI class LuaDebugger, which will be later made a public MUI custom class. Then every application using Lua for internal scripting and expose scripts to user, can embed a debugger and allow for easy script testing.

    A small example code accompanied with system includes and lua.library autodoc allows developers to try Lua scripting inside an application. Communication between C and Lua code is very easy.

    In the future I plan to add an "ARexx" module, enabling Lua to communicate with multiple applications via their ARexx ports. Then Lua can be used for the same purpose as ARexx, just with much nicer syntax, object oriented programming and, well, the source level debugger.

    It is also possible to add interfaces to system libraries. Having bindings to MUI Lua can become a rapid application development language. This is a bit more distant future however.
  • »06.12.10 - 17:19
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    Stevo
    Posts: 888 from 2004/1/24
    From: #AmigaZeux
    Impressive stuff!
    ---
    http://www.iki.fi/sintonen/logs/its_only_football.txt
  • »06.12.10 - 17:59
    Profile
  • Yokemate of Keyboards
    Yokemate of Keyboards
    Zylesea
    Posts: 2053 from 2003/6/4
    Nice one! As an occasional Hollywood user I think it will be pretty worthwhile to look into Lua. A big "thumbs up" for that!
    --
    http://via.bckrs.de

    Whenever you're sad just remember the world is 4.543 billion years old and you somehow managed to exist at the same time as David Bowie.
    ...and Matthias , my friend - RIP
  • »06.12.10 - 18:04
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    Tcheko
    Posts: 510 from 2003/2/25
    From: France
    Sermonatrix IRC client under developpement will make extensive use of this library. Current version uses it already and working nicely. User will be able to modify client behaviour with little programming knowledge : notify, highlight, sound, dcc handling, log, ... everything will be scriptable.

    http://czeko.free.fr/shot/sermo/sermorules.png
    Quelque soit le chemin que tu prendras dans la vie, sache que tu auras des ampoules aux pieds.
    -------
    I need to practice my Kung Fu.
  • »06.12.10 - 19:02
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    amigadave
    Posts: 2794 from 2006/3/21
    From: Northern Calif...
    Great news Krashan!

    I have to learn a lot more about the programming languages I am currently working to learn, but Lua sounds very interesting. Specially the Lua Explorador w/single stepping test mode, which is very helpful for beginning programmers to track down their mistakes.
    MorphOS - The best Next Gen Amiga choice.
  • »07.12.10 - 05:39
    Profile
  • Caterpillar
    Caterpillar
    Blasterreal
    Posts: 40 from 2007/3/30
    woooowwwwww thanks Krashan.
  • »07.12.10 - 09:04
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Yomgui
    Posts: 348 from 2004/8/31
    From: Québec - Canada
    Welcome to Lua on MorphOS!

    Our system starts to have powerful dev tools now.
    Now, developpers are waited ;-)
    And now... next project!
  • »07.12.10 - 10:14
    Profile Visit Website
  • Butterfly
    Butterfly
    insurgent
    Posts: 64 from 2007/7/8
    That's fantastic news - Lua is powerful scripting language. I was playing with Lua on AROS, including using MUI bindings. Indeed, an app can be put together real quick.
    Registered MOS 2.7 + Pack Ultimate 1.6.2 running on:
    Power Mac G4 FW800 1.42GHz 2GB / Radeon 9000 Pro 128MB / SB Live! / NEC USB 2.0 / SuperDrive
    Mac Mini G4 1.5GHz 1GB / 64MB VRAM / SuperDrive
    Dell UltraSharp 2407WFP 1920x1200
    PowerBook G4 ready :-)
  • »07.12.10 - 10:30
    Profile
  • MorphOS Developer
    Krashan
    Posts: 1107 from 2003/6/11
    From: Białystok...
    I've just implemented a MorphOS native 'package' module, so Lua can load external modules (only written in Lua for now, handling of compiled modules, being just MorphOS libraries, requires a bit more work). I will finish it and then implement the rest of Lua standard modules.
  • »08.12.10 - 16:29
    Profile Visit Website
  • Acolyte of the Butterfly
    Acolyte of the Butterfly
    Drako^lM
    Posts: 144 from 2005/8/10
    From: Poland , Chelm
    @ Krashan

    Wow

    Very nice work
    Time for learning the Lua
    Hardware :
    Power Mac G5 2.3 Ghz & MorphOS 3.18 & OSX 10.5
    Mini G4 1.5 Ghz & MorphOS 3.18
    BlaBla Team Member -> http://blabla.ppa.pl
    AmiParty Team Member -> http://www.chal.pl/
  • »08.12.10 - 16:52
    Profile Visit Website
  • Paladin of the Pegasos
    Paladin of the Pegasos
    jcmarcos
    Posts: 1178 from 2003/3/13
    From: Pinto, Madrid ...
    Nice work indeed... But makes me wonder if there's too many languages in MorphOS! A list of them would be nice, with some brief comments about its strong and weak points, and the kind of things it's most suitable for.
  • »09.12.10 - 08:18
    Profile
  • MorphOS Developer
    Krashan
    Posts: 1107 from 2003/6/11
    From: Białystok...
    I've almost finished loading compiled modules (in a form of system shared libraries). There is some strange crash to trace however. A skeleton of such module is ready and will be publicly available. Then it is very easy to accelerate Lua based applications with native modules written in C/C++.
  • »09.12.10 - 08:30
    Profile Visit Website
  • MorphOS Developer
    Krashan
    Posts: 1107 from 2003/6/11
    From: Białystok...
    The list is not so long in fact. Note that opinions given below are just my point of view, not the ultimate truth.
    1. Assembler - for advanced users, accelerating other languages in places where CPU should be pushed over the edge. Compiled.
    2. C - The base general purpose language. Compiled.
    3. C++ - The same as above, higher level of abstraction, not suited for low-level stuff (drivers, libraries etc.). Compiled.
    4. AmigaE - Can be considered as some "nicer version of C" without strict type control and with object oriented programming elements. General purpose, building applications mainly. Compiled.
    4. Perl - scripting and text processing. Used in the SDK for things like automated header files generation. Interpreted.
    5. Python - considered a script language, often use for scripting inside applications, can be also used to write applications. Covers similar application areas as Lua. In my opinion a bit bloated, on the other hand has lots of useful libraries. Interpreted.
    6. Lua - It seems it is the main competitor for Python on the MorphOS platform. More lightweight, probably faster. In my opinion easier to learn. Currently unfinished. When done it will be usable as scripting language (system-wide and inside applications) and rapid application building language. Interpreted.
    7. ARexx - scripting and controlling applications. The main disadvantage is ARexx is only available as 68k binaries and is not distributed with MorphOS. For controlling programs (its most popular application), can be replaced with Python, and soon with Lua. Can be used to create applications, but it is rather cumbersome. Interpreted.

    There are more languages (Pascal for example), but in my opinion not ready to use on MorphOS (well, Lua is not ready too, but it is actively developed).

    [ Edited by Krashan on 2010/12/9 8:48 ]
  • »09.12.10 - 08:46
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    Zylesea
    Posts: 2053 from 2003/6/4
    Quote:


    Krashan schrieb:
    Then it is very easy to accelerate Lua based applications with native modules written in C/C++.

    I would have loved this feature for Hollywood. I think I'll soonly have to take a deeper look to the actual differences between Hollywood's and Lua's general syntax since Hollywood is based on/uses Lua (in my recognition Hollywood is a modified Lua with a big and comfortable function library).
    --
    http://via.bckrs.de

    Whenever you're sad just remember the world is 4.543 billion years old and you somehow managed to exist at the same time as David Bowie.
    ...and Matthias , my friend - RIP
  • »09.12.10 - 15:59
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    amigadave
    Posts: 2794 from 2006/3/21
    From: Northern Calif...
    Quote:


    Krashan wrote:
    The list is not so long in fact. Note that opinions given below are just my point of view, not the ultimate truth.
    1. Assembler - for advanced users, accelerating other languages in places where CPU should be pushed over the edge. Compiled.
    2. C - The base general purpose language. Compiled.
    3. C++ - The same as above, higher level of abstraction, not suited for low-level stuff (drivers, libraries etc.). Compiled.
    4. AmigaE - Can be considered as some "nicer version of C" without strict type control and with object oriented programming elements. General purpose, building applications mainly. Compiled.
    4. Perl - scripting and text processing. Used in the SDK for things like automated header files generation. Interpreted.
    5. Python - considered a script language, often use for scripting inside applications, can be also used to write applications. Covers similar application areas as Lua. In my opinion a bit bloated, on the other hand has lots of useful libraries. Interpreted.
    6. Lua - It seems it is the main competitor for Python on the MorphOS platform. More lightweight, probably faster. In my opinion easier to learn. Currently unfinished. When done it will be usable as scripting language (system-wide and inside applications) and rapid application building language. Interpreted.
    7. ARexx - scripting and controlling applications. The main disadvantage is ARexx is only available as 68k binaries and is not distributed with MorphOS. For controlling programs (its most popular application), can be replaced with Python, and soon with Lua. Can be used to create applications, but it is rather cumbersome. Interpreted.

    There are more languages (Pascal for example), but in my opinion not ready to use on MorphOS (well, Lua is not ready too, but it is actively developed).

    [ Edited by Krashan on 2010/12/9 8:48 ]


    Nice list, but no mention of Hollywood/Hollywood Designer, or any "Basic" languages for beginning programmers, like True Basic, Blitz Basic, etc.

    Off Topic: I am compiling a list of Amiga/AROS/MorphOS programmers and beginning programmers to form a programmer support group where information can be exchanged and questions can be asked and answered. If you are a beginning programmer that is trying to learn, an intermediate programmer trying to improve your skills, or an experienced programmer that is willing to assist the first two types of programmers, please contact me with the following information.

    Name
    Nickname
    Where you live
    email address
    skill level
    programming languages known, or learning
    current programming projects you are working on

    The purpose of the list is to share between all group members so they know who they can contact for assistance and advice. I will also be adding to the spreadsheet a list of links to programming tutorials and other reference materials that are helpful to programmers.

    You can send me the above information at amigadave@earthlink.net
    MorphOS - The best Next Gen Amiga choice.
  • »09.12.10 - 16:16
    Profile
  • MorphOS Developer
    Krashan
    Posts: 1107 from 2003/6/11
    From: Białystok...
    @amigadave

    Nice list, but no mention of Hollywood/Hollywood Designer, or any "Basic" languages for beginning programmers, like True Basic, Blitz Basic

    True Basic and Blitz Basic are actively developed only in their Windows versions. And Hollywood uses Lua internally.

    BTW - mail sent but for some weird reason I'm getting a return with a message that my IP is blocked by EarthLink. Seems you have some paranoid spamfilter there.

    [ Edited by Krashan on 2010/12/9 20:25 ]
  • »09.12.10 - 20:23
    Profile Visit Website
  • Order of the Butterfly
    Order of the Butterfly
    Yomgui
    Posts: 348 from 2004/8/31
    From: Québec - Canada
    I need to correct some errors about Python (and for me, it's not my point of view, it's the reality, can be easily checked on the net):

    > "considered a script language"
    why "considered" ? Is it a script language.

    > "often use for scripting inside applications"

    Absolutely not.
    Almost Python scripts are standalones applications, runned from the "python" binary, then C-written modules are used to extend capacities of the core language.
    It's even written in official Python documentation that it's prefered to extend than to embeed Python.

    > "Covers similar application areas as Lua."

    I think not, and even some pro-lua coders also after reading some forum about "Python vs Lua".
    Lua is a lightweight language, mainly used to be embeeded in applications (the opposite of Python) and extend/control these applications.

    Not for my opinion: Lua is much more a pretender to replace Arexx than Python, because of its lightweight/embeed design as I've said before.

    Lua has a fast execution (faster than Python) but not cover the huge computer programing science area as Python does.

    Python comes with more "libraries". That's why it's used for develop complete applications, almost written in Python (and extended with C/C++ modules when needed).

    So Lua is (maybe) a suitable language for "noobs-of-the-noobs", then complex applications may be more easily and faster written in Python.

    Finally, I found Lua more cryptic than Python for some design patterns.

    Ah, I've forgotten to mention that the Lua core library is much more portable than Python.
    Lua keeps an ANSI compatibility. Python is much POSIX.

    [ Edited by Yomgui on 2010/12/9 23:05 ]
    And now... next project!
  • »09.12.10 - 22:02
    Profile Visit Website
  • MorphOS Developer
    Krashan
    Posts: 1107 from 2003/6/11
    From: Białystok...
    I've finished and tested the interface to binary C modules. Such modules are just system shared libraries and are used by Lua require function. The next step is to implement standard Lua packages as binary modules. Here is a screenshot showing Lua Explorador executing a script using functions from a binary example module. A skeleton code for Lua binary module is also ready and will be included to the package.
  • »10.12.10 - 11:04
    Profile Visit Website
  • Priest of the Order of the Butterfly
    Priest of the Order of the Butterfly
    boot_wb
    Posts: 874 from 2007/4/9
    From: Kingston upon ...
    Thanks Krashan,

    I'll download this and see if it helps me (as a "noob-of-the-noobs" ;-P) to start coding.

    One more language to add to the list: Ruby (albeit a minimal port)

    (I have installed Ruby, but couldn't figure out where to start in terms of updating & installing the gems packages. Mainly wanted to see if the BBC iPlayer workaround is still functional. iPlayer on MorphOS would be pretty funky, but until they implement html5 it seems to be a no-go)
    www.hullchimneyservices.co.uk

    UI: Powerbook 5,6 (1.67GHz, 128MB VRam): OS3.1, OSX 10.5.8
    HTPC: Mac Mini G4 (1,5GHz, 64MB VRam): OS3.1 (ZVNC)
    Audiophile: Efika 5200b (SB Audigy): OS3.1 (VNC + Virtual Monitor)

    Windows free since 2011!
  • »10.12.10 - 11:43
    Profile Visit Website
  • MorphOS Developer
    Krashan
    Posts: 1107 from 2003/6/11
    From: Białystok...
    @boot_wb

    I'll download this and see if it helps me (as a "noob-of-the-noobs" ;-P) to start coding.

    I suggest to wait for something more finished than the dirty preview. For example all Lua books assume the standard modules presence, which is not yet the case for my version. Also Lua Explorador is still rather a raw tool (I've improved it siginificantly in the meantime...).
  • »10.12.10 - 21:01
    Profile Visit Website
  • Yokemate of Keyboards
    Yokemate of Keyboards
    amigadave
    Posts: 2794 from 2006/3/21
    From: Northern Calif...
    Quote:


    Krashan wrote:
    @amigadave

    Nice list, but no mention of Hollywood/Hollywood Designer, or any "Basic" languages for beginning programmers, like True Basic, Blitz Basic

    True Basic and Blitz Basic are actively developed only in their Windows versions. And Hollywood uses Lua internally.

    BTW - mail sent but for some weird reason I'm getting a return with a message that my IP is blocked by EarthLink. Seems you have some paranoid spamfilter there.

    [ Edited by Krashan on 2010/12/9 20:25 ]


    I have had a couple of others complain about Earthlink's filtering, but don't know why they would block your IP. Can you try again to send me an email, or would you consider creating a free email account somewhere, like gmail, and see if you can send me an email from that new account?

    I would very much appreciate having both yourself and any other experienced programmers as part of the Amiga Programmers Support Group. I have been getting a good response from people interested in learning to program, or improving their programming skills and would like to keep the momentum growing.
    MorphOS - The best Next Gen Amiga choice.
  • »10.12.10 - 21:15
    Profile