Good Evening.
I have encountered the same problem as before, but this time for a slider.
This time I got a little bit deeper but still got stuck.
I used these two pages:
[url]http://wiki.garrysmod.com/page/Category:DNumSlider[/url]
[url]http://wiki.garrysmod.com/page/DNumSlider/OnValueChanged[/url]
[CODE]local DermaNumSlider = vgui.Create( "DNumSlider", Frame )
DermaNumSlider:SetPos( 10, 75 )
DermaNumSlider:SetSize( 300, 100 )
DermaNumSlider:SetText( "Nombre de Freekill" )
DermaNumSlider:SetMin( 0 )
DermaNumSlider:SetMax( 25 )
DermaNumSlider:SetDecimals( 0 )
DermaNumSlider:OnValueChanged(fk)[/CODE]
When I change the slider number and then use:
[CODE]print(fk)[/CODE]
It still gives me nil, so the variable hasn't been affected, and I want to know how to affect it.
All help is much appreciated, thank you for reading this post.
You might want to familiarize yourself with [URL="https://www.lua.org/pil/13.html"]functions and metamethods[/URL] before continuing...
[lua]local yourVar
-- Further down
function DermaNumSlider.OnValueChanged(self, newValue )
yourVar = newValue
end[/lua]
[QUOTE=JasonMan34;52467827]You might want to familiarize yourself with [URL="https://www.lua.org/pil/13.html"]functions and metamethods[/URL] before continuing...
[lua]local yourVar
-- Further down
function DermaNumSlider.OnValueChanged(self, newValue )
yourVar = newValue
end[/lua][/QUOTE]
I will look into it. Thank you very much for the advice!
[editline]14th July 2017[/editline]
[QUOTE=JasonMan34;52467827]You might want to familiarize yourself with [URL="https://www.lua.org/pil/13.html"]functions and metamethods[/URL] before continuing...
[lua]local yourVar
-- Further down
function DermaNumSlider.OnValueChanged(self, newValue )
yourVar = newValue
end[/lua][/QUOTE]
Works perfectly, thank you so much for your help!!
Sorry, you need to Log In to post a reply to this thread.