Latest topics
» New Website: www.rebel-tech.net
Sat Feb 14, 2009 3:40 am by AlphA-9

» Help with my lua
Mon Feb 09, 2009 10:39 pm by riho

» Maps, maps, oh god maps.
Mon Feb 09, 2009 9:59 pm by Dag_Killer

» Turok's cash
Mon Feb 09, 2009 8:16 pm by AlphA-9

» defaut map ?
Mon Feb 09, 2009 5:28 pm by riho

» NEW FORUM + WEBSITE + DONATION PAGE
Sun Feb 08, 2009 4:22 pm by AlphA-9

» new cookery mod?
Sun Feb 08, 2009 11:55 am by FireFx-UK-

» Pictures
Sat Feb 07, 2009 6:56 pm by riho

» My edit to the forum picture (the one at the top)
Sat Feb 07, 2009 6:25 pm by AlphA-9

Poll

what is the best map for defaut

 
 
 
 
 

View results

!! Traffic Counter !!
hit counter
123

New Website: www.rebel-tech.net

Help with my lua

View previous topic View next topic Go down

Help with my lua

Post  riho on Fri Feb 06, 2009 9:33 pm

Ok this only really applies if you know how to do lua,

ok here is my 1st. lua

1. function myTestFunction()
2. local myTable = {"Entry 1", "Another Entry", "Garry's Mod is pretty awesome! (learning lua scripts)"}
3. print("Contents of myTable:")
4. for key, value in pairs(myTable) do
5. print("Table entry #"..key..": "..value)
6. end
7. end
8.
9. concommand.Add("my_test_function", myTestFunction)

my 2nd

1. function TestVGUI()
2.
3. local Frame = vgui.Create( "Frame" );
4. Frame:SetSize( 200, 200 );
5. Frame:SetPos( 100, 100);
6. Frame:SetVisible( true );
7. Frame:MakePopup();
8. Frame:PostMessage( "SetTitle", "text", "This is the title" );
9.
10. local Button = vgui.Create( "Button", Frame );
11. Button:SetText( "Click me!");
12. Button:SetPos( 30, 5);
13. Button:SetWide( 100 );
14. function Button:DoClick( )
15. self:SetText( "Clicked" );
16. end
17.
18. end
19.
20. concommand.Add( "testvgui", TestVGUI);

and my 3rd.

1. function testpanel()
2. test = vgui.Create("DFrame")
3. menu1 = vgui.Create("DButton")
4.
5. test:SetPos(50,50)
6. test:SetSize(300, 300)
7. test:SetTitle( "Test" )
8. test:SetVisible( true )
9. test:MakePopup()
10. menu1:SetParemt( test )
11. menu1:SetText( "Menu >" )
12. menu1:SetPos(150, 150)
13. menu1:SetSize( 100, 20 )
14. menu1.DoClick = function ( btn )
15. local menu123 = DermaMenu()
16. menu123:AddOption("hello", function() Msg("Hello") end )
17. menu123:AddOption("how", function() Msg("How") end )
18. menu123:AddOption("are", function() Msg("Are") end )
19. menu123:AddOption("you", function() Msg("You") end )
20. menu123:AddOption("?", function() Msg("?") end )
21. menu123:Open()
22. end
23. end
24. concommand.Add("menutest", testpanel"

also (i only just done the 3rd one i dont know if it works) when i go on gmod, it says in console something like

my_test.lua:1: unexpected symbol near .1

wtf does that mean D:

reply Smile

_________________
Your password aint butter so dont spread it!

Crap with wireing?? visit this to learn

http://www.wiremod.com/forum/wiremod-tutorials/350-orb-s-wiremod-tutorials.htm

riho
Mega Poster
Mega Poster

Posts: 118
Join date: 2008-12-05
Age: 15

View user profile

Back to top Go down

Re: Help with my lua

Post  riho on Mon Feb 09, 2009 10:39 pm


_________________
Your password aint butter so dont spread it!

Crap with wireing?? visit this to learn

http://www.wiremod.com/forum/wiremod-tutorials/350-orb-s-wiremod-tutorials.htm

riho
Mega Poster
Mega Poster

Posts: 118
Join date: 2008-12-05
Age: 15

View user profile

Back to top Go down

View previous topic View next topic Back to top


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