LogoLogo
Join The CommunityCommunity ResourcesLuafaq.orgLua Org
  • Welcome
  • Frequently Asked Questions (FAQ)
  • Legacy API
    • Test The API
    • Warning
    • Character
      • v1/wear
      • v1/remove
    • Games
      • v1/games/details
    • User
      • v1/user/request-data
      • v1/user/avatar
      • v1/user/get-by-username
      • v1/user/get-token
      • v1/user/verify-password
      • v1/user/login
      • v1/user/chat/send-message
      • v1/user/chat/chat-summary
      • v1/user/get-messages
      • v1/user/chat/chats
      • v1/user/friends
      • v1/user/friend
      • v1/user/search
    • Guild
      • v1/join
    • Asset
      • v1/sell
      • v1/take-offsale
      • v1/purchase
      • v1/purchase-reseller
      • v1/create
      • v1/get
  • OPEN CLOUD
    • READ ME
    • NPM Package
      • Introduction
      • Tutorials
        • Webhook Configuration
      • Bot Account
      • OpenCloudClient
      • WebAPICliet
        • Client
        • login
        • quit
        • Friends Endpoint
          • SendFriendRequest
          • GetFriends
        • User Endpoint
          • GetAvatar
          • GetPlayerByUsername
        • Guild Endpoint
          • JoinGuild
    • Open Cloud
    • Webhooks
    • Asset Types
    • Beautiful JSON Display
    • V2 API
      • Asset
        • Edit
      • Publish
        • Asset
        • World
      • Feed
        • reply
        • all/{page_cursor/{feed_cursor}
      • Cloud
        • oauth
          • create
        • git/{channel}
        • version
        • database
          • get
          • set
        • credentials
          • list
          • delete
          • create
        • bricklinks
          • list
          • delete
          • create
      • Webhook
        • delete
        • create
        • list
      • User
        • feed
          • send
        • search
        • register
        • login
        • username-available
        • email-available
        • phone-available
        • validate-beta-key
        • id
        • username
        • edit-setting
        • transparency-request
      • Auth
        • send-beta-key
        • get-active-sessions
        • terminate-session
        • get-token
        • session
        • is-authed
        • join-game
        • bot-login
      • Notifications
        • unread
        • all
        • erase
      • Worlds
        • /{universe}/{server}/server/metadata/update/{token}
        • /{universe}/shutdown/all/{token}
        • /{universe}/shutdown/server/{server}/{token}
        • /{universe}/join/server/{server_id}
        • /{universe}/join/random
        • /{universe}/join/user/{user_id}
        • /client/{join_key}
        • /create-universe/{ownerId}/{ownerType}
        • /create-world/{universeId}
        • /worldtree/{worldId}
  • Developer Guide
    • Empowering Responsible Gameplay: A Guide to ModerationService in BrickVerse
    • Empowering Game Creators: A Deep Dive into ENVService with Lua API in BrickVerse
    • Leveraging ENVService as an FFlag System
    • What's Authority?
    • Roblox Vs BrickVerse Classes
    • DRM - Digital Rights Management
  • BrickLua - Coding With Lua
    • Introduction
    • Learn Lua
      • Functions
      • Strings
      • Tables
      • Boolean
      • Conditional Structures
      • Opeartors
      • bit32
      • Numbers
    • Player Event
  • GAME API
    • API
      • Intro
      • math
      • debug
      • coroutine
      • Enum
        • UserInput
        • Humanoid
    • Classes
      • ServiceProvider
        • Enum
        • InteractionService
        • ENVService
        • Void
        • WorldstoreService
        • WorldSettings
        • DiscordRichPresence
        • ClientGui
        • AuthorityService
        • SharedStorage
        • WebService
        • RunService
        • NetworkService
        • AdService
        • UserInputService
        • Scene
        • ChatService
        • Lighting
        • SoundService
        • Players
        • ServerStorage
        • ScriptService
      • DataType
        • CFrame
        • Instance
        • Vector2
        • Vector3
        • Color
      • Dynamic
        • Dynamic3D
          • SpotLight
          • SpawnPart
          • Projection3D
          • PartMaterial
          • OmniLight
          • BasePart
          • InteractionPrompt
          • Page
          • DirectionalLight
          • Brick
          • BasePartConstraint
        • ScriptDynamic
          • ScriptModule
        • BaseUI
          • ScrollFrame
          • ImageButton
          • TextButton
          • ImageLabel
          • TextLabel
          • Frame
          • ViewportFrame
          • ScreenUI
  • Employment
    • List Of Administrators
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. GAME API
  2. API

math

This library provides an interface to the standard C lua math library, encapsulating all functions within the math global.

Summary

Functions

abs(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the absolute value of (x).

acos(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the arc cosine of (x).

asin(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the arc sine of (x).

atan(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the arc tangent of (x) (in radians).

atan2(y, x): (\mathbb{R} \times \mathbb{R} \rightarrow \mathbb{R})

  • Returns the arc tangent of (y/x) (in radians), using the signs of both parameters to determine the quadrant of the result.

ceil(x): (\mathbb{R} \rightarrow \mathbb{Z})

  • Returns the smallest integer larger than or equal to (x).

clamp(x, min, max): (\mathbb{R} \times \mathbb{R} \times \mathbb{R} \rightarrow \mathbb{R})

  • Returns a number within the range ([min, max]).

cos(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the cosine of (x) (assumed to be in radians).

cosh(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the hyperbolic cosine of (x).

deg(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the angle (x) (in radians) in degrees.

exp(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the value (e^x).

floor(x): (\mathbb{R} \rightarrow \mathbb{Z})

  • Returns the largest integer smaller than or equal to (x).

fmod(x, y): (\mathbb{R} \times \mathbb{R} \rightarrow \mathbb{R})

  • Returns the remainder of the division of (x) by (y) that rounds the quotient towards zero.

frexp(x): (\mathbb{R} \rightarrow \mathbb{R} \times \mathbb{Z})

  • Returns (m) and (e) such that (x = m \times 2^e), (e) is an integer, and the absolute value of (m) is in the range ([0.5, 1)) (or zero when (x) is zero).

ldexp(x, e): (\mathbb{R} \times \mathbb{Z} \rightarrow \mathbb{R})

  • Returns (x \times 2^e).

log(x, base): (\mathbb{R} \times \mathbb{R} \rightarrow \mathbb{R})

  • Returns the logarithm of (x) using the given base, or the mathematical constant (e) if no base is provided (natural logarithm).

log10(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the base-10 logarithm of (x).

max(x, ...): (\mathbb{R} \times \mathbb{R}^* \rightarrow \mathbb{R})

  • Returns the maximum value among the numbers passed to the function.

min(x, ...): (\mathbb{R} \times \mathbb{R}^* \rightarrow \mathbb{R})

  • Returns the minimum value among the numbers passed to the function.

modf(x): (\mathbb{R} \rightarrow \mathbb{Z} \times \mathbb{R})

  • Returns two numbers, the integral part of (x) and the fractional part of (x).

noise(x, y, z): (\mathbb{R} \times \mathbb{R} \times \mathbb{R} \rightarrow \mathbb{R})

  • Returns a Perlin noise value.

pow(x, y): (\mathbb{R} \times \mathbb{R} \rightarrow \mathbb{R})

  • Returns (x^y).

rad(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the angle (x) (in degrees) in radians.

random(m, n): (\mathbb{Z} \times \mathbb{Z} \rightarrow \mathbb{Z})

  • Returns a random number within the range provided.

randomseed(x): (\mathbb{Z} \rightarrow \emptyset)

  • Sets (x) as the seed for the pseudo-random generator.

round(x): (\mathbb{R} \rightarrow \mathbb{Z})

  • Returns the integer with the smallest difference between it and the given number.

sign(x): (\mathbb{R} \rightarrow {-1, 0, 1})

  • Returns (-1) if (x < 0), (0) if (x = 0), or (1) if (x > 0).

sin(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the sine of (x) (assumed to be in radians).

sinh(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the hyperbolic sine of (x).

sqrt(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the square root of (x).

tan(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the tangent of (x) (assumed to be in radians).

tanh(x): (\mathbb{R} \rightarrow \mathbb{R})

  • Returns the hyperbolic tangent of (x).

Properties

  1. huge: (\mathbb{R})

    • Returns the value (HUGE_VAL), a value larger than or equal to any other numerical value (about (2^{1024})).

  2. pi: (\mathbb{R})

    • The value of (\pi).

PreviousIntroNextdebug

Last updated 1 year ago

Was this helpful?