DgsRoundUp: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}} __NOTOC__ This function returns rounded number from the inputed value. For example: 1.1 -> 1 1.5 -> 2 ==Syntax== <syntaxhighlight lang="lua"> intege...")
 
Line 13: Line 13:
integer/float dgsRoundUp ( integer/float input [, integer point ] )
integer/float dgsRoundUp ( integer/float input [, integer point ] )
</syntaxhighlight>
</syntaxhighlight>
===Required Arguments===
*'''input:''' The number you want to round up.
===Optional Arguments===
*'''point:''' The decimal point where the rounding up start to calculate. This can be changed by [[dgsSetRoundUpPoints]].
===Returns===
This function returns an integer or float value.
==Example==
<syntaxhighlight lang="lua">
DGS = exports.dgs
local num1 = DGS:dgsRoundUp(3.1)
outoutChatBox(num1)  -- returns 3
local num2 = DGS:dgsRoundUp(3.5)
outoutChatBox(num2)  -- returns 4
local num3 = DGS:dgsRoundUp(3.52,2)
outoutChatBox(num3)  -- returns 3.5
local num4 = DGS:dgsRoundUp(326.52,-1)
outoutChatBox(num4)  -- returns 330
</syntaxhighlight>
==See Also==
{{DGSFUNCTIONS}}

Revision as of 09:46, 3 May 2018

This function returns rounded number from the inputed value.

For example:

1.1 -> 1

1.5 -> 2

Syntax

integer/float dgsRoundUp ( integer/float input [, integer point ] )

Required Arguments

  • input: The number you want to round up.

Optional Arguments

  • point: The decimal point where the rounding up start to calculate. This can be changed by dgsSetRoundUpPoints.

Returns

This function returns an integer or float value.

Example

DGS = exports.dgs

local num1 = DGS:dgsRoundUp(3.1)
outoutChatBox(num1)  -- returns 3
local num2 = DGS:dgsRoundUp(3.5)
outoutChatBox(num2)  -- returns 4
local num3 = DGS:dgsRoundUp(3.52,2)
outoutChatBox(num3)  -- returns 3.5
local num4 = DGS:dgsRoundUp(326.52,-1)
outoutChatBox(num4)  -- returns 330

See Also

Custom Cursor Functions

Multi Language Supports

Animation

3D Element

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips