Forum

> > CS2D > General > lua script help
Forums overviewCS2D overviewGeneral overviewLog in to reply

English lua script help

8 replies
To the start Previous 1 Next To the start

old lua script help

EnderCrypt
User Off Offline

Quote
anyone now where i can find help making lua script

plz help i really need 1 and i never tried


us

old Re: lua script help

KimKat
GAME BANNED Off Offline

Quote
You could've used the "Lua Scripts/Questions/Help" thread/topic, if you haven't noticed it.

But I guess you could search for like lua on google and you might get some good results.

old Re: lua script help

ohaz
User Off Offline

Quote
the lua tutorials on google are not the best. Easiest way to learn lua is to open the info.txt in the lua folder and some of the sample scripts and just trying to read what they do

old Re: lua script help

EnderCrypt
User Off Offline

Quote
ok i have tryd reading it and... ...
its not really easy

i really need a script and i mean iit takes like 1 day teaching it if your god

old How to?

dzeijs
User Off Offline

Quote
how to i can script new unit in gfx? Please help!

old Re: lua script help

DC
Admin Off Offline

Quote
Lua scripting is for serversided scripting only.
you can't script "a new unit in gfx". you also can't add new weapons or stuff like that.

old Re: lua script help

vrkiller
User Off Offline

Quote
Lua is one of the badest languages i ever tryd, it just dosent make sense and its stupid
addhook is before the functions, its just 180 degrees around lol

old Re: lua script help

Lee
Moderator Off Offline

Quote
vrkiller has written
Lua is one of the badest languages i ever tryd, it just dosent make sense and its stupid
addhook is before the functions, its just 180 degrees around lol


You need to study the language design rather then just conceptualize it with regards to the traditional languages. Unlike static languages out there, Lua is one of the most dynamic languages you'll come to know, similarly, unlike languages such as Java where it's almost impossible to map out any one class-type, lua offers only the essentials.

Addhook is an inhouse function, here's a bit of its language design

lua have states, states are not statically inherited into the object they're exposed to, in this case, the runtime that blitz uses constantly updates the lua state. In such a case, you can use addhook before or after the function it's pointed to because by design, blitz takes the NAME of the function and maps it to the _G table. In this sense, addhook does nothing more then calling out the function at the key provided by the second parameter. This is a rather intuitive design because it allows us to use the full potentials of the dynamic nature of lua. Rather then binding the hook to a static function, blitz allows the function to "mutate" either independently or through exterior manipulation. In such a sense it's an essential feature that allows us to employ quite a variety of "esoteric" problem solving techniques.

A better understanding of the language design can be found by tracing out how a program runs. It may be beneficial to see where the conventional techniques ends and where the esoteric forms begins.

old Re: lua script help

DC
Admin Off Offline

Quote
@vrkiller: Lua makes sense and is not stupid! Maybe you just don't understand it. Understanding Lua should be very easy especially when you already know other programming/scripting languages. The only new thing you have to learn is the table stuff but this is very simple as well. Everything else is the stuff you should know from other languages: conditions, variables, loops, functions.

you can also write addhook AFTER the declaration of functions. it simply doesn't matter because the position of the declaration of functions in the source code does not matter as well. you should know that if you used other languages before.
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview