Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» Hey guys.........
Fri Sep 09, 2011 4:58 pm by WhiteWolf

» Last to post wins
Fri Sep 09, 2011 4:57 pm by WhiteWolf

» COMBAT ARMS WOOOOO
Tue Oct 19, 2010 10:59 pm by viperjake31

» Its over (Bye)
Wed Sep 22, 2010 10:05 pm by Supanooba

» Sorry guys...
Wed Sep 22, 2010 10:01 pm by Supanooba

» bad feeling...
Tue Sep 21, 2010 1:16 pm by Supanooba

» This game...
Sun Sep 19, 2010 10:01 am by Supanooba

» Me, D@rk T3mpl4r, Hacking?
Sun Sep 19, 2010 12:36 am by D@rk T3mpl4r

» fractured my arm and leg
Sat Sep 18, 2010 9:08 pm by Supanooba

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

[Tutorial] How to begin lua scripting.

View previous topic View next topic Go down

[Tutorial] How to begin lua scripting.

Post by WhiteWolf on Tue Jul 06, 2010 11:43 am

Well, me and my friends started trying to lua script, we learned the basics. So we tried to find a Basics Tutorial for newcomers, and we checked if we understand the tutorial, we did so here is the Basics of Lua Scripting, if any of you need a Advanced guide, just reply. bounce

http://www.cs2d.com/tut/tkdlua/luatut.html
http://www.cs2d.com/tut/tkdlua/luatut.html
http://www.cs2d.com/tut/tkdlua/luatut.html
http://www.cs2d.com/tut/tkdlua/luatut.html
http://www.cs2d.com/tut/tkdlua/luatut.html
avatar
WhiteWolf

Posts : 226
Rep : 12
Join date : 2010-06-11

View user profile

Back to top Go down

Re: [Tutorial] How to begin lua scripting.

Post by V1Kt0R on Fri Jul 09, 2010 3:03 pm

these tutorials are a great way to learn lua scripting. well for beginners like me they are great.
avatar
V1Kt0R

Posts : 196
Rep : 2
Join date : 2010-06-19
Age : 22
Location : Auburn

View user profile

Back to top Go down

Re: [Tutorial] How to begin lua scripting.

Post by WhiteWolf on Sat Jul 10, 2010 10:21 pm

V1Kt0R wrote:these tutorials are a great way to learn lua scripting. well for beginners like me they are great.

Glad it was good for you big bro.
avatar
WhiteWolf

Posts : 226
Rep : 12
Join date : 2010-06-11

View user profile

Back to top Go down

Re: [Tutorial] How to begin lua scripting.

Post by Starkkz on Sat Aug 07, 2010 10:08 pm

You can get info about lua scripting at.
sys/lua/info.txt or http://www.lua.org/manual/5.1/
Some hooks need functions and parameters..

The hook.
Code:

addhook("spawn","my_lua_hook_spawn")

The function. (This hook will call the function)
Code:

function my_lua_hook_spawn(id)
-- Here you can do what you want like use commands.
end

How to use command in console using lua scripts.
Code:

parse("command")

If you wanna make people get items at spawn you can do this.
Code:

function my_lua_hook_spawn(id)
parse("equip "..id.." 45")
end

And the player will get a laser.

The strings functions allow you to add more words in the same string.

Code:

mytable = {"I","am","testing","this","string","function"}
function table.join(t,j)
   if not j then j = " " end
   local new_string = ""
   if type(t) == "table" then
      for _, word in pairs(t) do
         new_string = new_string .. j .. word
      end
   end
   return new_string
end

my_string = table.join(mytable)
msg(my_string)

Starkkz

Posts : 30
Rep : 0
Join date : 2010-06-11

View user profile

Back to top Go down

Re: [Tutorial] How to begin lua scripting.

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum