Latest topics
123
New Website: www.rebel-tech.net
Help with my lua
2 posters
Page 1 of 1
Help with my lua
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
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
riho- Mega Poster
- Posts : 118
Join date : 2008-12-05
Age : 30
Re: Help with my lua
WHEEEEEEEEEEEEEEEEEEEE WAKE UP OLD FORUM !!!!!!!! WHEEEEEEEEEEE !!! A1T IS KING !!!! LOL
Romik12- Active Poster
- Posts : 33
Join date : 2008-12-27
Age : 30
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
Fri Aug 06, 2010 6:45 pm by Romik12
» John
Fri Aug 06, 2010 5:51 pm by Romik12
» [color=red][size=24]WHEEEEEEEEEEEEEEEEEEEE WAKE UP OLD FORUM !!!!!!!! WHEEEEEEEEEEE !!! A1T IS KING !!!! LOL [/size][/color]
Fri Aug 06, 2010 5:50 pm by Romik12
» Razer abusing READ
Fri Aug 06, 2010 5:49 pm by Romik12
» Mr.Jonson Random DM
Fri Aug 06, 2010 5:49 pm by Romik12
» Maps, maps, oh god maps.
Fri Aug 06, 2010 5:49 pm by Romik12
» VOTE FOR THE LAST ADMIN SPOT
Fri Aug 06, 2010 5:47 pm by Romik12
» Maybe a new server?
Fri Aug 06, 2010 5:44 pm by Romik12
» Dodgy lag jumps and console errors
Fri Aug 06, 2010 5:43 pm by Romik12