Author Topic: Why does this return a nil value to my var?  (Read 3484 times)

0 Members and 1 Guest are viewing this topic.

Offline LuaTenshi

  • Hero Member
  • *****
  • Posts: 545
  • Karma: 47
  • Just your ordinary moon angel!
    • Mirai.Red
Why does this return a nil value to my var?
« on: November 04, 2011, 08:28:58 PM »
Code: [Select]
local textbox = vgui.Create("TextEntry", DermaPanel)
textbox:SetPos( 5,290 )
textbox:SetTall( 20 )
textbox:SetWide( 150 )
textbox:SizeToContents()

textboxval = textbox:GetValue()

local button = vgui.Create( "DButton", DermaPanel )
button:SizeToContents()
button:SetPos( 5,310 )
button:SetSize( 150, 20 )
button:SetText( "Cleanup!" )
        button:SetConsoleCommand( "ups_clnstr".. textboxval )

Honestly I have no idea but textboxval returns nil even tho I am getting a value from user input...

Is LUA broken in Gmod or did I some how manage to break my client side LUA?
I cry every time I see that I am not a respected member of this community.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Why does this return a nil value to my var?
« Reply #1 on: November 05, 2011, 11:11:01 AM »
Sorry, I've no experience with Derma.
I tried to poke around the garrysmod.com wiki, but it kept timing out/acting slow.
I found something about a DTextEntry.GetValue, but thats when everything started crashing.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Why does this return a nil value to my var?
« Reply #2 on: November 06, 2011, 11:58:47 PM »
Code: [Select]
local textbox = vgui.Create("TextEntry", DermaPanel)
Are you sure you didn't mean to create a "DTextEntry"?
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Why does this return a nil value to my var?
« Reply #3 on: November 07, 2011, 04:17:35 AM »
Code: [Select]
local textbox = vgui.Create("TextEntry", DermaPanel)
Are you sure you didn't mean to create a "DTextEntry"?

That.  I was doing something like this earlier too.  Stickly was kind enough to help me via steam chat.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Why does this return a nil value to my var?
« Reply #4 on: November 07, 2011, 03:08:37 PM »
I found something about a DTextEntry.GetValue, but thats when everything started crashing.
Me, Aaron, Stickly man blah blah Dtextentry blah blah

That.

Glad I guessed right. Shame Gmod wiki is/was so slow as to not help me, with my lack of Derma experience, help you more.
Glad we could help.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming