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
  • Logical
  • Relational
  • Arithmetic
  • Miscellaneous
  • Compound Assignment

Was this helpful?

Edit on GitHub
  1. BrickLua - Coding With Lua
  2. Learn Lua

Opeartors

PreviousConditional StructuresNextbit32

Last updated 1 year ago

Was this helpful?

An operator is a special set of symbols used to perform an operation or conditional evaluation.

Logical

The logical operators for are and, or, and not. These operators consider both false and nil as “false” and anything else as “true.”

Operator
Description

and

Evaluates as true only if both conditions are true

or

Evaluates as true if either condition is true

not

Evaluates as the opposite of the condition

Relational

Relational operators compare two parameters and return a true or false.

Operator
Description
Associated metamethod

==

Equal to

__eq

~=

Not equal to

>

Greater than

<

Less than

__lt

>=

Greater than or equal to

<=

Less than or equal to

__le

Arithmetic

Lua supports the usual binary operators along with exponentiation, modulus, and unary negation.

Operator
Description
Example
Associated metamethod

+

Addition

1 + 1 = 2

__add

-

Subtraction

1 - 1 = 0

__sub

*

Multiplication

5 * 5 = 25

__mul

/

Division

10 / 5 = 2

__div

^

Exponentiation

2 ^ 4 = 16

__pow

%

Modulus

13 % 7 = 6

__mod

-

Unary negation

-2 = 0 - 2

__unm

Miscellaneous

Miscellaneous operators include concatenation and length.

Operator
Description
Associated metamethod

..

Concatenates two strings

__concat

#

__len

Compound Assignment

Compound assignment operators are used to set a variable equal to the result of an operation where the first parameter is the variable’s current value.

The expression on the left side of a compound assignment is only evaluated once. For example, if an expression generates a random index in a table, the same index is used for both the operation and the assignment.

Operator
Operation

+=

Addition

-=

Subtraction

*=

Multiplication

/=

Division

%=

Modulus

^=

Exponentiation

..=

Concatenation

Length of

conditional statements
boolean
table