PtokaX forum

Development Section => LUA & PtokaX-Scripting-Interface => Topic started by: Devongrrl on 12 December, 2004, 14:54:33

Title: newbie question about lua scripting
Post by: Devongrrl on 12 December, 2004, 14:54:33
i understand that lua scripts are compiled

where can i get source code from to see how to modify scripts

i have done a little C++ and lots of vb and VBS before
Title:
Post by: ??????Hawk?????? on 12 December, 2004, 15:07:05
hi  

you can only get the source  if the  Creator decides to give it out  ...
Title:
Post by: Devongrrl on 12 December, 2004, 15:34:31
Perhaps I asked the wrong questions ?(  !

Once I have created my script how do or what should i use to complie it into a lua file ?

Title:
Post by: enema on 12 December, 2004, 18:11:05
you can create txt file and just change its extension to lua or use ptokaX (script editor)
Title:
Post by: plop on 12 December, 2004, 18:51:19
QuoteOriginally posted by Devongrrl
Perhaps I asked the wrong questions ?(  !

Once I have created my script how do or what should i use to complie it into a lua file ?


lua is a scripting language, this means there is no need 2 compile it like c++.
a script is nothing more then a text file.
but there is a small difference between lua and other scripting languages.
normaly scripting languages interpret a script character by character, every space is interpretted but this means it wastes time.
lua compiles the script the moment it loads it, the result gives more speed (it removes all unneeded spaces for example).
but what about those compilers some ppl use you might ask now, those compilers are pre-compilers.
this gives between 25-50% extra speed.
you can find sutch a pre-compiler for lua on my website.
the way 2 use it is simple.
luac -o

plop
Title:
Post by: Typhoon on 12 December, 2004, 21:55:31
plop, isn't it only at first script load  it really takes advantage of the precompilers like "luac",  hope you understand my point :o)


Typhoon?
Title:
Post by: plop on 13 December, 2004, 23:14:06
QuoteOriginally posted by Typhoon?
plop, isn't it only at first script load  it really takes advantage of the precompilers like "luac",  hope you understand my point :o)


Typhoon?
yep on loading lua compiles them, using a pre-compiler makes lua's own compiler more efficient.

plop
Title:
Post by: Typhoon on 14 December, 2004, 22:24:02
okay , but still only at first load ? , or when compiled it works faster when running constant and not only at first load  ? ...


Typhoon?
Title:
Post by: plop on 14 December, 2004, 23:03:40
QuoteOriginally posted by Typhoon?
okay , but still only at first load ? , or when compiled it works faster when running constant and not only at first load  ? ...


Typhoon?
it makes the compiler more efficient so you get a more optimized script.
which runs faster all the time.

plop
Title:
Post by: VidFamne on 15 December, 2004, 22:10:27
hmm
QuoteThe main advantages of precompiling chunks are: faster loading, protecting source code from user changes, and off-line syntax checking.

Pre-compiling does not imply faster execution because in Lua chunks are always compiled into bytecodes before being executed. luac simply allows those bytecodes to be saved in a file for later execution
 
found this on Luac's man page  >>HERE<< (http://www.wra1th.plus.com/lua/v310/luac.html)