Page 1 of 1

Learn Lua scripting?

Posted: Sun Apr 06, 2008 2:19 am
by synthsin75
I'm thinking of learning lua scripting. Do I need an executible version? If so, which is best for ASP script writing? I assume the executible will at least show quick feedback for lua errors. Maybe one with a ASP library?

Posted: Sun Apr 06, 2008 3:59 am
by Rasheed
First learn Lua (see lua.org). Next dissect some menu scripts, next some of the layer scripts in the script forum, then the tool scripts (those are the hardest to grasp).

Anime Studio is written in C++, which is clearly visible in nomenclature of methods and classes in the Lua application program interface (API). Although you can write procedural routines (first this, then that) in layer scripts, for tool scripts you also need to know what object oriented programming is (what classes and object are, what inheritance is, and the like). You can all learn this, but it will take time.

Posted: Sun Apr 06, 2008 4:24 am
by heyvern
I use ASP as my "error" feedback. I don't have any kind of Lua interpreter or runtime engine. I just test my scripts in ASP. Keep in mind this will probably mean you will crash ASP a lot or have to force it to close if you get some kind of nasty loop that never ends (I often get ASP flickering and jittering like it was having a seizure and have to force quit).

No compiling is neccessary. Lua is just plain text like a javascript file in a web page.

There are lots of things the "latest" version of Lua can do that aren't "in" ASP. I believe also that ASP is a version behind on Lua. there are some math commands or something that are in the newest version of Lua that ASP doesn't have... at least from my testing.

Also if you search on the web for lua info keep in mind that lua itself is extensible with libraries. The lua in ASP can't make use of those extensions (unless mike clifton includes them).

Basically lua is "compiled" inside ASP... somehow... in some magical way (I think unicorns and elves might be involved... maybe Tom Cruise!).

So to do the testing just use ASP. It has a console that pops up to show errors and "print" commands. Using some kind of lua runtime engine wouldn't help with ASP because there are special things built in that aren't part of lua. The script might be perfectly valid lua code but if it isn't running in ASP you wouldn't find the errors.

In my opinion lua is about as hard to learn as javascript or actionscript. You can go crazy with it and do all kinds of wild stuff... or you can just do simple functional things.

-vern

Posted: Sun Apr 06, 2008 4:25 am
by synthsin75
Thanks Rasheed. I don't know if I'll have any luck. Like I said elsewhere, I gave up Flash for needing to learn scripting, but no one seems willing or able to script the tools I'm needing. :roll:

Posted: Sun Apr 06, 2008 4:30 am
by synthsin75
Yeah Vern, I was trying that, but it was all guess work/ trial and error. I couldn't even find the bit in a tool script that handled what ended up selected after creation. ...and I tried just about every 'select' reference I could find. :cry:

Posted: Sun Apr 06, 2008 6:57 am
by heyvern
Everything I learned was from studying existing scripts and basically trial and error.

Much of the scripting in AS is NOT DOCUMENTED. The scripting reference has everything... there... but there isn't any examples of how it's used in "context". Flash for instance, will have examples of how a particular thing is used in the context of a small bit of code.

I've often thought to start some kind of online library of that kind of thing. For instance a wiki specific to ASP lua scripting. Duplicate the scripting reference and add examples for reference.

-vern

Posted: Sun Apr 06, 2008 8:04 am
by synthsin75
That may help bring AS scripting out of the domain of the dedicated few. I haven't given it up yet, but it looks like it'd be quite some time before I be able to script anything useful. :?

Looks like I'll need to dissect a few scripts and take notes of what scripting references are used where/how. I've already downloaded the reference.

Posted: Sun Apr 06, 2008 3:07 pm
by dueyftw
I learned to program on a vic 20 and even learned to program 6502 assembler. I can't seem to get the oo languages and gave up. Every time I see a dot operator I wonder where the program flow went to and what local variable has been pushed on the stack.

Dale

Posted: Sun Apr 06, 2008 7:28 pm
by Rasheed
That's too bad, Dale, because object oriented programming has so much to offer.

While procedural programming is easy to understand, object oriented programming is powerful, because it only does things when it is supposed to do so. With procedural programming, you are constantly asking your computer to check: "Has this happened, has that happened?" With oo programming, you tell a story: "If this happens, do that." Object oriented programming lends itself much better for graphical user interfaces, mouse clicks and key presses.

You can even write OO in assembly language; there's nothing stopping you there. There isn't anything special about OO languages, other than that they have built-in support for OO, which you would have to program yourself in assembly language (or use an existing library).

There is much more to object oriented programming, but that would be outside of the scope of this thread, and, anyway, there are people who can explain theory much better than I can.