Garry's Mod Wiki

Revision Difference

DNumberWang:SetFraction#518167

<function name="SetFraction" parent="DNumberWang" type="panelfunc"> <ispanel>yes</ispanel> <description>Sets the value of the number selector based on the given fraction number.</description> <realm>Client</realm> <args> <arg name="val" type="number">The fraction of the number selector&#x27;s range.</arg> <arg name="val" type="number">The fraction of the number selector's range.</arg> </args> </function> <example> <description>Sets and prints out the value of a quarter, half, and three-fourths of the number selector range.</description> <code> local numinput = vgui.Create("DNumberWang") numinput:SetPos(5, 5) numinput:SetSize(90, 20) numinput:SetMinMax(0, 500) numinput:SetFraction(0.25) print(numinput:GetValue()) numinput:SetFraction(0.5) print(numinput:GetValue()) numinput:SetFraction(0.75) print(numinput:GetValue()) </code> <output> ``` 125 250 375 ``` </output> </example>