Garry's Mod Wiki

DNumberWang:GetFraction

DNumberWang:GetFraction( number val )

Description

Returns a fraction representing the current number selector value to number selector min/max range ratio. If argument val is supplied, that number will be computed instead.

Arguments

1 number val
The fraction numerator.

Example

Prints out some fractions based on a number selector with a min/max range of 0 to 255.

local numinput = vgui.Create("DNumberWang") numinput:SetPos(5, 5) numinput:SetSize(90, 20) numinput:SetMinMax(0, 255) numinput:SetValue(64) print(numinput:GetFraction()) -- Should return ~0.25 print(numinput:GetFraction(128)) -- Should return ~0.5 print(numinput:GetFraction(192)) -- Should return ~0.75 print(numinput:GetFraction(255)) -- Should return 1
Output:
0.25098039215686 0.50196078431373 0.75294117647059 1

Page Links


Special Pages


Wikis

?

Render Time: 35ms

Session 0
DB GetPage 3
Generate Html 6
SaveChanges 12
Render Body 0
Render Sidebar 12