Constants & Enums
This page documents all available constants and enumerations used throughout the GrowSoft Lua API. Use these constants in your scripts for better code readability and maintainability.
Centralized Reference
All constants are defined here in one place. Individual API pages link to this reference for easy lookup.
World Punishment Types
Constants for world-specific player punishments:
WORLD_BAN = 1 -- Ban player from the world
WORLD_MUTE = 2 -- Mute player in the worldUsage:
-- Ban a player from the world for 1 hour
world:addPunishment(player, WORLD_BAN, os.time() + 3600, "Rule violation", 0)
-- Mute a player for 30 minutes
world:addPunishment(player, WORLD_MUTE, os.time() + 1800, "Spam", 0)
-- Check for punishment
local punishment = world:getPunishment(player, WORLD_BAN)
if punishment then
print("Player is banned until: " .. punishment.expires)
endSee World Punishments for more details.
World Flags
Flag IDs used with world:hasFlag(id) to check world properties:
| Flag ID | Property | Description |
|---|---|---|
| 0 | Open to public | World is publicly accessible |
| 1 | Signal jammer | Signal is jammed |
| 2 | Punch jammer | Punching is disabled |
| 3 | Zombie jammer | Zombies are disabled |
| 4 | Balloon jammer | Balloons are disabled |
| 5 | Antigravity | Gravity is reversed/disabled |
| 6 | Ghost jammed | Ghosts are disabled |
| 7 | Pineapple guardian | Protected by pineapple guardian |
| 8 | Firehouse | Firehouse active |
| 9 | Mini-mod | Mini-mod enabled |
| 10 | Xenonite crystal | Xenonite crystal active |
| 11 | Silenced | World chat is silenced |
| 12 | Silenced, but admins ignore | Silenced except for admins |
| 13 | Instant collect gems | Gems collected instantly |
| 14 | Block dropped items | Items cannot be dropped |
| 15 | Disable ghost | Ghosts disabled |
| 16 | Disable cheats | Cheats/mods disabled |
| 17 | Disable one-hit | One-hit breaking disabled |
Usage:
-- Check if world is open to public
if world:hasFlag(0) then
print("World is public!")
end
-- Check if punching is disabled
if world:hasFlag(2) then
player:onConsoleMessage("Punching is jammed in this world!")
end
-- Check multiple flags
if world:hasFlag(13) and world:hasFlag(3) then
print("World has instant gem collection and zombie jammer")
endSee World Flags for more details.
Ghost Types
Constants for spawning different ghost types in worlds:
GHOST_NORMAL = 1 -- Normal ghost (speed: 33)
GHOST_ANCESTOR = 4 -- Ancestor ghost (speed: 33)
GHOST_SHARK = 6 -- Shark ghost (speed: 33)
GHOST_WINTERFEST = 7 -- Winterfest ghost (speed: 33)
GHOST_BOSS = 11 -- Boss ghost (speed: 33)
GHOST_MIND = 12 -- Mind ghost (speed: 132)Recommended Movement Speeds:
- Most ghosts:
33 - Mind ghost:
132
Usage:
local tile = world:getTile(10, 10)
-- Spawn a normal ghost
world:spawnGhost(tile, GHOST_NORMAL, 0, 0, 33)
-- Spawn a mind ghost with faster speed
world:spawnGhost(tile, GHOST_MIND, 0, 0, 132)
-- Spawn a boss ghost that disappears in 60 seconds
world:spawnGhost(tile, GHOST_BOSS, 0, 60, 33)See Ghost Spawning for more details.
Discord Reply Flags
Flags for modifying Discord message behavior:
ReplyFlags = {
CROSSPOSTED = bit.lshift(1, 0),
IS_CROSSPOST = bit.lshift(1, 1),
SUPRESS_EMBEDS = bit.lshift(1, 2),
SOURCE_MESSAGE_DELETED = bit.lshift(1, 3),
URGENT = bit.lshift(1, 4),
HAS_THREAD = bit.lshift(1, 5),
EPHEMERAL = bit.lshift(1, 6),
LOADING = bit.lshift(1, 7),
THREAD_MENTION_FAILED = bit.lshift(1, 8),
SUPRESS_NOTIFICATIONS = bit.lshift(1, 12),
IS_VOICE_MESSAGE = bit.lshift(1, 13),
HAS_SNAPSHOT = bit.lshift(1, 14),
USING_COMPONENTS_V2 = bit.lshift(1, 15)
}Common Flags:
| Flag | Value | Description |
|---|---|---|
| EPHEMERAL | bit.lshift(1, 6) | Message only visible to the user who triggered it |
| SUPRESS_EMBEDS | bit.lshift(1, 2) | Don’t show link previews/embeds |
| SUPRESS_NOTIFICATIONS | bit.lshift(1, 12) | Don’t send push notification |
Usage:
-- Send an ephemeral reply (only visible to the user)
onDiscordMessageCreateCallback(function(event)
if event:getContent() == "-secret" then
event:reply(
"This message is only visible to you!",
nil,
ReplyFlags.EPHEMERAL,
0
)
end
end)
-- Combine multiple flags
local flags = bit.bor(ReplyFlags.EPHEMERAL, ReplyFlags.SUPRESS_NOTIFICATIONS)
event:reply("Silent ephemeral message", nil, flags, 0)See Discord Integration for more details.
Subscription Types
Constants for managing player subscriptions:
TYPE_SUPPORTER = 0
TYPE_SUPER_SUPPORTER = 1
TYPE_YEAR_SUBSCRIPTION = 2
TYPE_MONTH_SUBSCRIPTION = 3
TYPE_GROWPASS = 4
TYPE_TIKTOK = 5
TYPE_BOOST = 6
TYPE_STAFF = 7
TYPE_FREE_DAY_SUBSCRIPTION = 8
TYPE_FREE_3_DAY_SUBSCRIPTION = 9
TYPE_FREE_14_DAY_SUBSCRIPTION = 10Usage:
-- Check if player is a supporter
if player:getSubscription(TYPE_SUPPORTER) ~= nil then
player:onConsoleMessage("Thank you for being a supporter!")
end
-- Add a month subscription
local expireTime = os.time() + (30 * 24 * 60 * 60)
player:addSubscription(TYPE_MONTH_SUBSCRIPTION, expireTime)
-- Add permanent GrowPass
player:addSubscription(TYPE_GROWPASS, 0) -- 0 = permanentSee Player Subscriptions for more details.
Item Rarity Levels
Numeric rarity values returned by item:getPricedRarity():
| Value | Rarity Level | Description |
|---|---|---|
| 0 | No Info | No rarity information available |
| 1 | Common | Common items |
| 2 | Uncommon | Uncommon items |
| 3 | Rare | Rare items |
| 4 | Very Rare | Very rare items |
| 5 | Epic | Epic items |
| 6 | Legendary | Legendary items |
| 7 | Mythical | Mythical items |
Usage:
local item = getItem(242) -- World Lock
local rarity = item:getPricedRarity()
if rarity >= 5 then
player:onConsoleMessage("This item is Epic or higher!")
elseif rarity == 0 then
player:onConsoleMessage("Rarity unknown for this item")
else
player:onConsoleMessage("Item rarity level: " .. rarity)
endSee Item Information for more details.
Tile Data Properties
Enumeration for accessing tile data with tile:getData(property):
TileDataProperties = {
TILE_DATA_PROPERTY_NONE = 0,
TILE_DATA_PROPERTY_LOCK_ITEM_ID = 1,
TILE_DATA_PROPERTY_DOOR_DESTINATION = 2,
TILE_DATA_PROPERTY_DOOR_ID = 3,
TILE_DATA_PROPERTY_SIGN_TEXT = 4,
TILE_DATA_PROPERTY_OWNER_USER_ID = 5,
TILE_DATA_PROPERTY_ACCESS_LIST_COUNT = 6
}Usage:
-- Get lock item ID from a lock
local lockItemID = tile:getData(TileDataProperties.TILE_DATA_PROPERTY_LOCK_ITEM_ID)
-- Get door destination
local destination = tile:getData(TileDataProperties.TILE_DATA_PROPERTY_DOOR_DESTINATION)
-- Get sign text
local text = tile:getData(TileDataProperties.TILE_DATA_PROPERTY_SIGN_TEXT)
-- Get lock owner
local ownerID = tile:getData(TileDataProperties.TILE_DATA_PROPERTY_OWNER_USER_ID)
-- Get access list count
local count = tile:getData(TileDataProperties.TILE_DATA_PROPERTY_ACCESS_LIST_COUNT)Role Properties
Properties for accessing Role data with role:getProperty(property):
RoleProperties = {
ROLE_ID = 0,
ROLE_NAME = 1,
ROLE_COLOR = 2,
ROLE_BUBBLE_COLOR = 3,
ROLE_FLAGS = 4,
ROLE_XP_MULTIPLIER = 5,
ROLE_QUEST_DAY = 6,
ROLE_DISCORD_ROLE_ID = 7
}Usage:
for _, role in ipairs(player:getRoles()) do
local roleID = role:getProperty(RoleProperties.ROLE_ID)
local roleName = role:getProperty(RoleProperties.ROLE_NAME)
local roleColor = role:getProperty(RoleProperties.ROLE_COLOR)
local xpMult = role:getProperty(RoleProperties.ROLE_XP_MULTIPLIER)
local discordRoleID = role:getProperty(RoleProperties.ROLE_DISCORD_ROLE_ID)
print(string.format("Role: %s (ID: %d, XP Mult: %.2f, Discord: %s)",
roleName, roleID, xpMult, discordRoleID or "none"))
endBreaking Change
ROLE_DISCORD_ROLE_ID now returns a string instead of a number. Update any code that expected a numeric value!
Role Flags
Flags for role permissions and features:
RoleFlags = {
ROLE_FLAG_INVISIBLE = bit.lshift(1, 0),
ROLE_FLAG_IGNORE_OFFLINE_MODS = bit.lshift(1, 1),
ROLE_FLAG_CAN_ADD_WORLD_OWNER = bit.lshift(1, 2),
ROLE_FLAG_ADMIN = bit.lshift(1, 3),
ROLE_FLAG_SUPER_MODERATOR = bit.lshift(1, 4),
ROLE_FLAG_MODERATOR = bit.lshift(1, 5),
ROLE_FLAG_CAN_KICK = bit.lshift(1, 6),
ROLE_FLAG_CAN_BAN = bit.lshift(1, 7),
ROLE_FLAG_CAN_MUTE = bit.lshift(1, 8),
ROLE_FLAG_CAN_VIEW_INVENTORY = bit.lshift(1, 9),
ROLE_FLAG_CAN_ACCESS_WORLD_INVENTORY = bit.lshift(1, 10),
ROLE_FLAG_CAN_ACCESS_ROLE_VENDOR = bit.lshift(1, 11),
ROLE_FLAG_CAN_BYPASS_ANTI_CHEAT = bit.lshift(1, 12),
ROLE_FLAG_CAN_NT_LOCK = bit.lshift(1, 13),
ROLE_FLAG_CAN_NE_LOCK = bit.lshift(1, 14),
ROLE_FLAG_SHOW_ON_TAB = bit.lshift(1, 15),
ROLE_FLAG_DISABLE_CHAT = bit.lshift(1, 16),
ROLE_FLAG_CAN_USE_GLOBAL_CHAT = bit.lshift(1, 17),
ROLE_FLAG_MODERATOR_CHAT = bit.lshift(1, 18),
ROLE_FLAG_CAN_BYPASS_ROLE_LOCK = bit.lshift(1, 19),
ROLE_FLAG_CAN_BYPASS_ACCOUNT_LEVEL_LOCK = bit.lshift(1, 20),
ROLE_FLAG_NOT_ON_LEADERBOARD = bit.lshift(1, 21),
ROLE_FLAG_SEE_MODERATORS = bit.lshift(1, 22),
ROLE_FLAG_UNAFFECTED_BY_AUTOKICK = bit.lshift(1, 23),
ROLE_FLAG_RECEIVE_REPORTS = bit.lshift(1, 24),
ROLE_FLAG_CAN_BROADCAST = bit.lshift(1, 25),
ROLE_FLAG_QUEUE_SKIP = bit.lshift(1, 26),
ROLE_FLAG_CAN_CURSE = bit.lshift(1, 27),
ROLE_FLAG_CAN_ACCESS_MINIGAME_ITEMS = bit.lshift(1, 28),
ROLE_FLAG_CANNOT_BE_CURSED = bit.lshift(1, 29),
ROLE_FLAG_CAN_DROP_NO_DROP = bit.lshift(1, 30),
ROLE_FLAG_CAN_DROP_NO_TRADE = bit.lshift(1, 31),
ROLE_FLAG_CAN_CREATE_SLOT_MACHINE = bit.lshift(1, 32)
}Usage:
local roleFlags = role:getProperty(RoleProperties.ROLE_FLAGS)
-- Check if role can ban
if bit.band(roleFlags, RoleFlags.ROLE_FLAG_CAN_BAN) ~= 0 then
print("This role can ban players")
end
-- Check multiple permissions
if bit.band(roleFlags, RoleFlags.ROLE_FLAG_ADMIN) ~= 0 or
bit.band(roleFlags, RoleFlags.ROLE_FLAG_SUPER_MODERATOR) ~= 0 then
print("This role has high-level permissions")
endItem Category Flags
Flags returned by item:getCategories():
ItemCategoryFlags = {
ITEM_CATEGORY_SEED = bit.lshift(1, 0),
ITEM_CATEGORY_CLOTHING = bit.lshift(1, 1),
ITEM_CATEGORY_CONSUMABLE = bit.lshift(1, 2),
ITEM_CATEGORY_LOCK = bit.lshift(1, 3),
ITEM_CATEGORY_CHECKPOINT = bit.lshift(1, 4),
ITEM_CATEGORY_DEADLY = bit.lshift(1, 5),
ITEM_CATEGORY_PLATFORM = bit.lshift(1, 6),
ITEM_CATEGORY_BACKGROUND = bit.lshift(1, 7),
ITEM_CATEGORY_SPLICING = bit.lshift(1, 8),
ITEM_CATEGORY_BLOCK_BOUNCY = bit.lshift(1, 9),
ITEM_CATEGORY_BLOCK_CHECKPOINT = bit.lshift(1, 10),
ITEM_CATEGORY_BLOCK_FOREGROUND = bit.lshift(1, 11),
ITEM_CATEGORY_BLOCK_GATEWAY = bit.lshift(1, 12),
ITEM_CATEGORY_BLOCK_MUSICAL = bit.lshift(1, 13),
ITEM_CATEGORY_BLOCK_PORTALS = bit.lshift(1, 14),
ITEM_CATEGORY_BLOCK_BEDROCK = bit.lshift(1, 15),
ITEM_CATEGORY_ANIMATED = bit.lshift(1, 16),
ITEM_CATEGORY_BLOCK_MULTI_FACING = bit.lshift(1, 17),
ITEM_CATEGORY_BLOCK_ENTRY = bit.lshift(1, 18),
ITEM_CATEGORY_HOUSE = bit.lshift(1, 19),
ITEM_CATEGORY_USABLE = bit.lshift(1, 20)
}Usage:
local item = getItem(242) -- World Lock
local categories = item:getCategories()
-- Check if item is a lock
if bit.band(categories, ItemCategoryFlags.ITEM_CATEGORY_LOCK) ~= 0 then
print("This is a lock item")
end
-- Check for clothing
if bit.band(categories, ItemCategoryFlags.ITEM_CATEGORY_CLOTHING) ~= 0 then
print("This is a clothing item")
end
-- Check for seed
if bit.band(categories, ItemCategoryFlags.ITEM_CATEGORY_SEED) ~= 0 then
print("This is a seed")
endItem Editable Flags
Flags returned by item:getEditableFlags():
ItemEditableFlags = {
ITEM_EDITABLE_FLAG_WRENCHABLE = bit.lshift(1, 0),
ITEM_EDITABLE_FLAG_CAN_EQUIP = bit.lshift(1, 1),
ITEM_EDITABLE_FLAG_UNTRADEABLE = bit.lshift(1, 2),
ITEM_EDITABLE_FLAG_PERMANENT = bit.lshift(1, 3),
ITEM_EDITABLE_FLAG_UNDROPPABLE = bit.lshift(1, 4),
ITEM_EDITABLE_FLAG_AUTO_PICKUP = bit.lshift(1, 5),
ITEM_EDITABLE_FLAG_MODDABLE = bit.lshift(1, 6),
ITEM_EDITABLE_FLAG_GUILD_ITEM = bit.lshift(1, 7),
ITEM_EDITABLE_FLAG_NO_DROP = bit.lshift(1, 8),
ITEM_EDITABLE_FLAG_NO_SELF = bit.lshift(1, 9)
}Usage:
local item = getItem(242)
local flags = item:getEditableFlags()
-- Check if item is wrenchable
if bit.band(flags, ItemEditableFlags.ITEM_EDITABLE_FLAG_WRENCHABLE) ~= 0 then
print("Item can be wrenched")
end
-- Check if item can be traded
if bit.band(flags, ItemEditableFlags.ITEM_EDITABLE_FLAG_UNTRADEABLE) ~= 0 then
print("Item cannot be traded")
end
-- Check for auto-pickup
if bit.band(flags, ItemEditableFlags.ITEM_EDITABLE_FLAG_AUTO_PICKUP) ~= 0 then
print("Item has auto-pickup enabled")
endPlayer Clothing Slots
Constants for clothing slots used with player clothing methods:
PlayerClothes = {
PLAYER_CLOTHES_HAIR = 0,
PLAYER_CLOTHES_SHIRT = 1,
PLAYER_CLOTHES_PANTS = 2,
PLAYER_CLOTHES_FEET = 3,
PLAYER_CLOTHES_FACE = 4,
PLAYER_CLOTHES_HAND = 5,
PLAYER_CLOTHES_BACK = 6,
PLAYER_CLOTHES_MASK = 7,
PLAYER_CLOTHES_NECKLACE = 8,
PLAYER_CLOTHES_ANCES = 9
}Usage:
-- Get player's current hair
local hairID = player:getClothes(PlayerClothes.PLAYER_CLOTHES_HAIR)
print("Player is wearing: " .. getItem(hairID):getName())
-- Get shirt
local shirtID = player:getClothes(PlayerClothes.PLAYER_CLOTHES_SHIRT)
-- Get wings/back item
local backID = player:getClothes(PlayerClothes.PLAYER_CLOTHES_BACK)
-- Check if player is wearing mask
local maskID = player:getClothes(PlayerClothes.PLAYER_CLOTHES_MASK)
if maskID > 0 then
print("Player is wearing a mask")
endSee Also
- World Structure - World methods and properties
- Player Structure - Player methods and subscriptions
- Item Structure - Item properties and rarity
- Discord Integration - Discord bot features