DiscordLua
discorddiscord
v1.2.4
Install

BitField

bitfield
On this page

BitField is a DiscordLua bitfield representing a Discord resource. Obtain it from a manager, an event payload, or the constructor when one is documented below.

bitfield Module 1.2.4 Source

Constructor

BitField.new(bits)

The class table is callable, so BitField(bits) is the same as .new.

NameTypeRequiredBehavior
bits any required Passed through to the implementation as written.
lua
local discord = require("discord")
local object = discord.BitField({})

Properties

BitField.bitfield

# readonly
Name
bitfield
Type
any
Access
readonly
Description
Instance field BitField.bitfield. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this BitField.

BitField.flags

# readonly
Name
flags
Type
any
Access
readonly
Description
Instance field BitField.flags. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this BitField.

BitField.frozen

# readonly
Name
frozen
Type
any
Access
readonly
Description
Instance field BitField.frozen. Read it after the object is constructed or wrapped from Gateway/REST data.
Availability
Populated from the Gateway/REST payload or constructor for this BitField.

Methods

BitField:add()

#

Add an item to this BitField.

Signature

BitField:add(...)

Parameters

NameTypeRequiredBehavior
... any required Passed through to the implementation as written.

Returns

BitField — the same instance, for chaining.

Throws

A DiscordLua error when arguments are invalid or the request fails without a callback.

Example

lua
local discord = require("discord")
-- object is a BitField
object:add(...)

BitField:any()

#

Performs any on this BitField. Call it from bot code when you need that operation on the current object.

Signature

BitField:any(bit)

Parameters

NameTypeRequiredBehavior
bit any required Passed through to the implementation as written.

Returns

BitField — the same instance, for chaining.

Throws

A DiscordLua error when arguments are invalid or the request fails without a callback.

Example

lua
local discord = require("discord")
-- object is a BitField
object:any(bit)

BitField:clone()

#

Performs clone on this BitField. Call it from bot code when you need that operation on the current object.

Signature

BitField:clone()

Parameters

No parameters.

Returns

BitField — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a BitField
object:clone()

BitField:equals()

#

Return whether this BitField refers to the same resource as the argument.

Signature

BitField:equals(other)

Parameters

NameTypeRequiredBehavior
other any required Passed through to the implementation as written.

Returns

BitField — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a BitField
object:equals(other)

BitField:freeze()

#

Performs freeze on this BitField. Call it from bot code when you need that operation on the current object.

Signature

BitField:freeze()

Parameters

No parameters.

Returns

BitField — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a BitField
object:freeze()

BitField:has()

#

Performs has on this BitField. Call it from bot code when you need that operation on the current object.

Signature

BitField:has(bit)

Parameters

NameTypeRequiredBehavior
bit any required Passed through to the implementation as written.

Returns

BitField — the same instance, for chaining.

Throws

A DiscordLua error when arguments are invalid or the request fails without a callback.

Example

lua
local discord = require("discord")
-- object is a BitField
object:has(bit)

BitField:missing()

#

Performs missing on this BitField. Call it from bot code when you need that operation on the current object.

Signature

BitField:missing(bit)

Parameters

NameTypeRequiredBehavior
bit any required Passed through to the implementation as written.

Returns

BitField — the same instance, for chaining.

Throws

A DiscordLua error when arguments are invalid or the request fails without a callback.

Example

lua
local discord = require("discord")
-- object is a BitField
object:missing(bit)

BitField:remove()

#

Remove an item from this BitField.

Signature

BitField:remove(...)

Parameters

NameTypeRequiredBehavior
... any required Passed through to the implementation as written.

Returns

BitField — the same instance, for chaining.

Throws

A DiscordLua error when arguments are invalid or the request fails without a callback.

Example

lua
local discord = require("discord")
-- object is a BitField
object:remove(...)

BitField.resolve()

# static

Resolve a snowflake, object, or mention to a cached instance.

Signature

BitField.resolve(bit)

Parameters

NameTypeRequiredBehavior
bit any required Passed through to the implementation as written.

Returns

BitField — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a BitField
BitField.resolve(bit)

BitField:serialize()

#

Performs serialize on this BitField. Call it from bot code when you need that operation on the current object.

Signature

BitField:serialize()

Parameters

No parameters.

Returns

BitField — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a BitField
object:serialize()

BitField:toArray()

#

Performs to array on this BitField. Call it from bot code when you need that operation on the current object.

Signature

BitField:toArray()

Parameters

No parameters.

Returns

BitField — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a BitField
object:toArray()

BitField:toJSON()

#

Serialize this BitField into a Lua table suitable for REST or debugging.

Signature

BitField:toJSON()

Parameters

No parameters.

Returns

BitField — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a BitField
object:toJSON()

BitField:valueOf()

#

function valueOf() { [native code] }

Signature

BitField:valueOf()

Parameters

No parameters.

Returns

BitField — the same instance, for chaining.

Example

lua
local discord = require("discord")
-- object is a BitField
object:valueOf()

Static members

  • BitField.Flags

Examples

lua
local discord = require("discord")
local object = discord.BitField({})

ActivityFlagsBitField · ApplicationFlagsBitField · AttachmentFlagsBitField · ChannelFlagsBitField · GuildMemberFlagsBitField · IntentsBitField · InviteFlagsBitField · MessageFlagsBitField

Version: discord 1.2.4 · runtime 1.0.0

Search Ctrl K Navigate Open Esc