DgsRoundUp: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 21: Line 21:


===Returns===
===Returns===
This function returns an integer or float value.
This function returns an integer or float value if succeed, ''false'' otherwise.


==Example==  
==Example==  

Revision as of 09:47, 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 if succeed, false otherwise.

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