BlitzLua 0.1 preview

BlitzMax Forums/BlitzMax Module Tweaks/BlitzLua 0.1 preview

Rozek(Posted 2007) [#1]
Hello!

(this is the author's first attempt to publish a BlitzMax module and executable)

Instead of continuously postponing the release of the full package (because of too much other work), I just published the first pre-alpha version of "BlitzLua", a Lua interface for many BlitzMax and MaxGUI modules (see the internal documentation for a complete list).

With BlitzLua, it is possible to run Lua scripts which have full access to graphical user interfaces, 2D and 3D graphics, sound and networking - under Windows, Linux and MacOS X. BlitzLua uses the author's version of the axe.lua module.

You may use the module to evaluate Lua scripts within your own BlitzMax application or use a precompiled executable to run stand-alone Lua scripts.

BlitzLua comes in three "flavours": a "function interface", an "object interface" and an "objective interface" - the "function interface" has been implemented and is fully usable, the remaining interfaces should come within the next two weeks.

The package should currently be considered as "pre-alpha": it has only roughly been tested, and this will not change until the "objective interface" has been fully implemented.

The full source code is available at

http://www.Andreas-Rozek.de/BlitzMax/BlitzLua.zip

After downloading the ZIP archive you should create a new folder "lua.mod" within the BlitzMax module folder (i.e. <blitzmax-installation-folder>/mod/lua.mod/) and unpack the archive into that directory.

If not already done, you should also download and install the author's (inofficial) version of axe.lua (see link above) - the "official" version is not sufficient!

After unpacking, please "Build Modules" and "Document Modules" from within your BlitzMax IDE. Afterwards, the module and its documentation are available.

The stand-alone executable (called BlitzLua) is available at

- Windows: http://www.Andreas-Rozek.de/BlitzMax/BlitzLua.debug.exe
- MacOS X: http://www.Andreas-Rozek.de/BlitzMax/BlitzLua.debug.app.zip
- Linux: http://www.Andreas-Rozek.de/BlitzMax/BlitzLua.debug

The module documentation also contains some information about the BlitzLua executable.

Please send any questions and bug reports to the author.


Rozek(Posted 2007) [#2]
A minor update has just been released. Apart from a file which was missing before (LuaIcon.o), the package now contains a few additional files (mainly Lua logo graphics) and a slightly modified documentation.

If you plan to compile the BlitzLua executable under Windows (or run the examples on any platform), you should download the actual version - otherwise, you don't really need it.


Rozek(Posted 2007) [#3]
A new release is on the server.

It primarily fixes a bug, where BlitzMax NULL objects (which might result from a failed create or load operation) get passed to Lua as a NULL userdata (which is useless and difficult to check under Lua) rather than as NIL (which is the proper Lua way)

Additionally, you may now loadImage and loadAnimImage - I simply "forgot" to implement them (sorry)

Furthermore, I ported Simon H.s "Fireworks" example (I ran across it yesterday, were impressed by the ratio of "effect" vs. "effort", and decided to try that with BlitzLua) What should I say: it (fire)works! Under Windows XP, MacOS X and Linux!!!!

My son would probably say "cool" - but I'm too old for that metaphor.

Indeed, BlitzMax and Lua seem to form a powerful combination!


Barbapapa(Posted 2007) [#4]
Just wanted to say thanks. I'm deep into my work right now, using Blitz3D, but your LUA integration is very very cool ;) and I will hopefully be back on BMAx soon.


SofaKng(Posted 2007) [#5]
I'm a little confused about this...

Does BlitzLua allow me to code in Lua and not need to code in BlitzBasic anymore? If so, that would be AMAZING! I don't have anything about BlitzBasic, but I would love to use Lua for 100% of my coding... (I think it supports more advanced OOP concepts as well)

If my understanding is correct, will I be use all of the BlitzMax functionality (and the 3rd party modules I download) from inside of BlitzLua?

Thanks!


Rozek(Posted 2007) [#6]
John,

yes - in the extreme case, you could just use the BlitzLua stand-alone executable (which is part of the package, but may also be downloaded separately) to run plain Lua scripts which then have (almost) full access to BlitzMax/MaxGUI's modules (2D/3D graphics, audio, networking, etc.)

You can use the functionality of all modules, for which I have written interfaces. There is no automatic interfacing mechanism (for arbitrary BlitzMax or third-party modules) since BlitzMax does not have any kind of introspection. However, it would not be difficult to write your own interfaces - it's just tedious work...

In practice, you would probably prototype your applications with Lua and then replace time-critical (or computationally expensive) parts with BlitzMax code.

Myself, I am planning a system similar to HyperCard and Smalltalk with Lua as scripting language and BlitzMax/MaxGUI for all the non-Lua features. This would include the ability to modify a "system" (i.e. program and data) at runtime with automatic persistence of any modifications - but don't expect anything before July. Some other stuff will come before...

The article about BlitzLua in the Lua wiki will give you more information about the package - especially the three "flavours" of the interface: the "function interface", the "object interface" and the "objective interface". The first two map BlitzMax functions and objects (types) to corresponding Lua functions and "classes" - and you will need to know BlitzMax/MaxGUI (and have access to the BlitzMax/MaxGUI documentation) if you really want to use them. The third "flavour", however, only loosely resembles the BlitzMax objects and reflect, what the author would want the BlitzMax interface to look like (and also offers additional functionalities such as an automatic layout mechanism for GUI components). You won't need any BlitzMax knowledge to use the "objective interface"...

The package itself contains even more documentation (which I am not allowed to place on the Lua wiki) - just download the archive and either install it (if you want to try BlitzLua) or unpack it somewhere else (if you just want to safely browse the documentation)

I'm open to any kind of feedback (bug reports, wish lists, comments, etc.) but please keep in mind: you currently get a pre-alpha release - full testing will not start before the "objective interface" has been completely implemented (which I now plan for June, 15th)


patmaba(Posted 2007) [#7]
Rosek,

After the few months on our last discussion on lua, I'm learning the lua and his integration in bmax.

It is insane what I can do by combining the 2 langagues.

For my needs, I use lua for 2 points. The first is the initialization of my environnement(scene, mesh, image, camera...). the last point and not the least, is externalising the business layer in a script lua.

I have difficulty to define the final structure of my program. My Last test bet impress me on the result.

Thank you Rozek to have made me discover lua through your articles and message on the forum.

Patmaba


Rozek(Posted 2007) [#8]
Patrick,

thanks for the plaudit - myself, I'm curious to see, how BlitzLua will perform when dealing with 3D graphics. It should perform quite well, as most of the computational stuff should be done within the 3D engines - but one never knows before having tried...

Actually, my goal will have been reached when programmers do not know (in advance) how much coding they should do in Lua and how much in BlitzMax. Or, in other words: when they may start prototyping in Lua and porting time critical aspects to BlitzMax later. This should increase everyones productivity (which is what I have in mind)


Rozek(Posted 2007) [#9]
Hello,

not much progress has been made during the last few days (too much "other" work)

However, there is now a new BlitzLua executable for MacOS X which uses the Lua logo rather than that of BlitzMax. This allows to distinguish between Lua scripts running under BlitzLua and "real" BlitzMax programs.

The respective .icns file is also available separately:

www.Andreas-Rozek.de/BlitzMax/BlitzLua.icns


Gabriel(Posted 2007) [#10]
The lack of replies to this thread is sad. If you've not tried this, you don't know what you're missing out on. It's really cool, really useful and a lot of fun too. I'm using the Lua module rather than BlitzLua itself ( mainly because I no longer use Max2d ) but if I was using Max2d, I would surely be doing so with BlitzLua, because you've done a fantastic job of this.

This module deserves much more praise than it's had, it's a great piece of work, and thanks heaps for all your work on it.


Otus(Posted 2007) [#11]
It might be that this thread is not in the correct forum. This isn't a "module tweak", it's a whole new module. I would have noticed this much earlier if it were posted to BlitzMax Programming.

Going to try it out now, however.


Rozek(Posted 2007) [#12]
Hello,

it's hard these days to find spare time for work on BlitzLua - however, I've now another release ready (containing a few bugfixes and an initial set of examples - more to come)

The BlitzLua stand-alone executables have been updated as well. Please note, that I did not have the time to test my examples on all three platforms: they *should* run, but there is no guarantee (indeed, I know, that Linux has problems with some BlitzMax code)

I've also included a "port" of Simon's "fireworks" example. It still includes his own "spark.png" file for which I hereby ask for the copy-right, i.e., the right to copy it into my set of examples (it would not be difficult to provide my own PNG file, though)


Rozek(Posted 2007) [#13]
Jan,

you might be right...again, this is my *first* attempt to publish a BlitzMax module - thus, please be patient with me ;-)

I'll probably publish the next announcement somewhere else (hmmm, but then you'll argue that BlitzMax already exists and has just been tweaked... ;-) )


WendellM(Posted 2007) [#14]
Andreas,

This looks very promising, thank you. I'm still new to Lua (only poked around with it a little and put together a small "runtime interpreter" window to try things out). But seeing the fireworks example running shows what it can really do! I look forward to exploring BlitzLua.

Wendell