[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua script to Windows or DOS executable?
- From: The Doctor <the_doctor@...>
- Date: Wed, 25 Aug 2004 22:41:17 +0100
Thankyou everyone for help here, I have some suggestions I can use
right away. :) (And I'll answer each mail in this one cos I think it
might be kinder to people's inboxes this way).
Thankyou Phillipe (and Roberto), you're right, I missed the (io.stdout).
I got tired at the end of that session and was trying all sorts, and
somehow missed it. The assert idea is especially nice, the use of a
single variable to name the output. I might have used a small
function with name passed as argument, but this is much neater.
Thankyou Eric, This rocks.
It works as immediately as I was used to in PtokaX, and I've almost
immediately grasped how to set up the basics of a very useful display.
The only thing I miss is some error reports to go on, though my
usual policy with those is: don't worry about details I don't
understand; just tighten the code so it stops producing any kind of
error. Thus, clues are vital as I can't interpret these scripts with
the raw Lua.exe...
I notice a curious extension of an assigned background colour that
runs to the end of a line rather than only surrounding the printed
character, but I guess this is something I can fix by use of the code
you've given me, once I practise it more.
One strangeness: I've seen some odd resizing effects in the console
window in this OS, and the colour changes would cease to work on
running a newly-made EXE a couple of times between new builds, though
this was pretty much cured by closing the window and restarting after
re-opening it. The sizing oddnesses persisted a bit though, and
slightly affected text positions in your example script. I'm using a
W95 shell on W98 SE (Shane Brooks' 98 lite), and that might have
something to do with it, possibly, although it's not something I ever
saw before in this OS..)
Calling one script is enough for me. It can include others called by
it anyway, I imagine, same as I used in Lua4 (as modules). I've found
that to be good practise for example in a PtokaX hub, to avoid the
overhead of parsing inputs in parallel needlessly, and I've read here
today that people have had difficulty running concurrent script
threads, though that detail is beyond me..
This packing tool you mentioned sounds excellent, far more than I'd
imagined. It appears to offer the same ease I have now, but with
power to create anything, from an EXE of no greater size than needed,
to a fully customised Lua shell that can be designed and assembled
easily by almost anyone using just the bits they need (assuming that
libraries need only be present in the same dir or on the system path).
If that doesn't make Lua's survival guaranteed, I don't know what
will. It would depend on pre-built libraries, but so does most of
anything I know how to do in Windows. >:) The idea of using existing
tools like batch scripts to give build instructions is especially
useful, as this is one of the few native powers M$ OS's make
available to us. I value highly anything that uses the known, inbuilt
OS core tools rather than require a huge or complex install on top to
make it go.
Thanks Roberto, that compatibility will be very useful. I'll learn
the new code though, now I have an easy way to do this, but if I get
that running it will be helpful to test partially converted scripts. :)
Thankyou Luiz, I'm definitely interested, though I don't know how to
use it. Does it do the same thing as the library Eric added to his
latest Lua2exe?
The building of a single executable though, is beyond me. While I
could learn, it's fair to say that it really is not easy for me, we
can't all be athletes, and not every driver is a mechanic. I'd love
to build it, and maybe have credit for it, but neither is most likely.
:) I'm thinking that if I have brought some focus to the idea, that
might be of worth though, as sometimes a driver will see what a
mechanic might miss.
There's no doubt that a colourful command window GUI with prompts
possible for user input, will enormously increase the use of Lua as a
general purpose tool in Windows machines, especially if it reports
script errors and does not require anything other than the executable
itself and a lua script to output customised executables. (It seems
likely that if it ran in two modes, it would be ideal. Mode 1: Run
like Lua.exe for writing and debugging, error reports.. Mode 2: Build
EXE when ready, debugging and error reporting code not passed to
output EXE). It would certainly be my main tool, becoming more
important that JavaScript. In fact, as an extension to this: If the
LuaIDE tool became able to make custom layouts for dialog-based or
even windowed GUI apps, with static text and buttons and colours and
such, to me this would be a much easier, smaller, and more desirable
tool than MSVC++, as so many of the same tasks could be done so much
faster and more easily by it. I'd pay for one, though I know how
wildly software charges can vary, so I can't be sure I can meet an
asking price.. I'd try though. What Eric has done might be easy to
him but it seems miraculous to me, and I think it will please a great
many people to see this in action. Windows actually has many virtues,
and this would go a long way to rectify the lack.
Ultimately it's Lua itself that makes best sense to me. C hurts my
head, it's simply impossible to think it, as a true language, as I
can't say it in my mind like words. It's like raw maths, not
something my brain does well, being strongly suited to words and
their meanings, but poorly fitted to abstractions that can't be
conveyed that way. Lua is different, I can grasp it the same way as a
spoken meaning, and the use of Lua as I've outlined it, and now seen
it done, in the last two days, will help many people, not just me.