PDA

View Full Version : GVMS-LUA


Ron
October 13th, 2002, 03:55 PM
Okay, I've got a Lua implementation here that I would like for you to try. Its a different type of script from GVMS, it is much more powerfull.

http://www.girder.nl/temp/gvms.zip

Documentation can be found here ( get the 'draft' book its pretty good )

http://www.lua.org/docs.html

For the value on which girder bases the decision to jump to the first or the second command we now use a variable : "result"

Thus, putting 0 into this will trigger the second command, any other value will trigger the first value.

Also you can define functions. You'll only need to trigger them once. The scripting engine keeps them in memory. So take a look at the example script, there is a command called "load function" this loads the function addgir into the script. This function is then called from the "work script" command. Pretty cool huh!

For you people out there that want to use hex numbers: tonumber("0x0a", 16) is the way to go. This is also my biggest gripe with this language, it doesn't handle hex numbers :roll:

There is no compatibility with the old GVMS.

Give some feedback if this script can do everything that you like.

Installation: Unzip the gvms.dll and replace the original gvms.dll in the girder directory. ( KEEP A BACKUP of the original )

Disclaimer: this is not the finished implementation it might not even be the language that we are going to use in girder its a test version nothing more nothing less.

Update: Before I forget if there is an error in the script Girder reports a line number this is not correct anymore, its the error code of Lua.

Mark F
October 13th, 2002, 03:55 PM
From a first read of the programming language reference manual, the only thing missing is bit-wise operators (| & ! ^, etc.). These, or equivilent functions could be added as an extension so I don't see this as a big thing.

The language and syntax looks simple enough though some of the constructs will take a while to get used to. (x, y = y, x; exchanges variables????)

I haven't tried it yet but if it is fast, it will work for me. :D

Ron
October 13th, 2002, 03:55 PM
WAY ahead of you :-) I saw this shortcoming and implemented them already.

mod
band
bor
bxor
bnot
shiftl
shiftr

Use them as functions, mod(10,9) would yield 1.

It should be fast especially if you use functions that you load once ( as per example addgir). These are then compiled into byte code and the next time you use them they are FAST!

x,y = y, x ... Yeah there are some strange contructs in this language :-)