New Website: www.rebel-tech.net
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Latest topics
» wheeee!
Help with  my lua EmptyFri Aug 06, 2010 6:45 pm by Romik12

» John
Help with  my lua EmptyFri Aug 06, 2010 5:51 pm by Romik12

» [color=red][size=24]WHEEEEEEEEEEEEEEEEEEEE WAKE UP OLD FORUM !!!!!!!! WHEEEEEEEEEEE !!! A1T IS KING !!!! LOL [/size][/color]
Help with  my lua EmptyFri Aug 06, 2010 5:50 pm by Romik12

» Razer abusing READ
Help with  my lua EmptyFri Aug 06, 2010 5:49 pm by Romik12

» Mr.Jonson Random DM
Help with  my lua EmptyFri Aug 06, 2010 5:49 pm by Romik12

» Maps, maps, oh god maps.
Help with  my lua EmptyFri Aug 06, 2010 5:49 pm by Romik12

» VOTE FOR THE LAST ADMIN SPOT
Help with  my lua EmptyFri Aug 06, 2010 5:47 pm by Romik12

» Maybe a new server?
Help with  my lua EmptyFri Aug 06, 2010 5:44 pm by Romik12

» Dodgy lag jumps and console errors
Help with  my lua EmptyFri Aug 06, 2010 5:43 pm by Romik12

Poll

what is the best map for defaut

Help with  my lua Vote_lcap17%Help with  my lua Vote_rcap 17% [ 8 ]
Help with  my lua Vote_lcap13%Help with  my lua Vote_rcap 13% [ 6 ]
Help with  my lua Vote_lcap42%Help with  my lua Vote_rcap 42% [ 20 ]
Help with  my lua Vote_lcap15%Help with  my lua Vote_rcap 15% [ 7 ]
Help with  my lua Vote_lcap15%Help with  my lua Vote_rcap 15% [ 7 ]

Total Votes : 48

!! Traffic Counter !!
hit counter
123

New Website: www.rebel-tech.net


Help with my lua

2 posters

Go down

Help with  my lua Empty Help with my lua

Post  riho Fri Feb 06, 2009 11: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
riho
riho
Mega Poster
Mega Poster

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

Back to top Go down

Help with  my lua Empty Re: Help with my lua

Post  riho Tue Feb 10, 2009 12:39 am

riho
riho
Mega Poster
Mega Poster

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

Back to top Go down

Help with  my lua Empty Re: Help with my lua

Post  Romik12 Fri Aug 06, 2010 5:39 pm

WHEEEEEEEEEEEEEEEEEEEE WAKE UP OLD FORUM !!!!!!!! WHEEEEEEEEEEE !!! A1T IS KING !!!! LOL
Romik12
Romik12
Active Poster
Active Poster

Posts : 33
Join date : 2008-12-27
Age : 30

Back to top Go down

Help with  my lua Empty Re: Help with my lua

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


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