Skip to main content

Shared Lua libraries

Use require to import a library supplied by your Hexis build. You don't copy its code into each script or download it from this site.

local format = require("hexis/format")
local farming = require("hexis/skyblock/farming")

Each run gets its own module cache. Requiring the same path again returns the same module inside that run. Different scripts don't share mutable Lua tables. Libraries receive the calling script's capabilities; importing one grants no extra authority. Put the capabilities you use in requestedCapabilities.

Available library contracts

Require pathCallsCapabilities
hexis/formatshort(value), rate(value)None
hexis/retryrun(factory, options)Whatever the factory uses
hexis/skyblock/chat_patternsmatch(text)None; obtaining chat events needs its own capability
hexis/skyblock/skillsnew(names, options); tracker update(), get(name)world.entities.read
hexis/skyblock/tablistlines(), match(pattern), containing(text), number(text), invalidate()world.entities.read
hexis/skyblock/farmingharvest(profile, options), inspect(options), run(options), run_rows(options)See farming

These paths describe the current source contract. Use the matching build when testing. Nested farming helpers are implementation details, not supported imports. Libraries follow the installed build's version; they aren't independently updated.

Numbers and chat

local format = require("hexis/format")
local chat = require("hexis/skyblock/chat_patterns")

local coins = format.short(44717041) -- "45M"
local rate = format.rate(1045136619) -- "1.0B/hr"
local hit = chat.match("[Bazaar] Bought 12x Wheat for 120 coins!")

short and rate return "-" for a missing value. match returns a table with kind and any parsed count, item, or coins, or nil when nothing matches. The library recognizes rare drops, pet drops, overflow, sacks, Bazaar purchases and sales, NPC sales, Limbo, and server restarts. Server wording can change.

Bounded retries

local retry = require("hexis/retry")
local result, attempt = retry.run(function()
return hexis.navigate.to({destination = {x = 12, y = 70, z = -8}})
end, {attempts = 3, timeout = 60, backoff = 2, max_backoff = 10})

The factory returns a new action handle per attempt. The helper awaits it, stops on success or a non-retryable failure, and otherwise retries up to attempts. The delay doubles up to max_backoff. Defaults are 3 attempts, 60 seconds per await, 1 second initial delay, and 30 seconds maximum delay. Use a positive integer for attempts. Don't retry a farming checkpoint without checking the player's position and farm first.

Editor support

Add the host annotations and the declarations below to your Lua language server's workspace.library. Keep the hexis/ directory structure beneath your chosen library directory so require resolves its path. These files contain declarations, not runnable libraries.

The catalog and declarations are generated from the same source snapshot as the API reference. The source commit identifies which contract you're reading; it doesn't establish live acceptance.

Share skill tracking

local skills = require("hexis/skyblock/skills")
local tracker = skills.new({"Farming"}, {warmup_seconds = 30})
tracker:update()
local farming = tracker:get("Farming")

Call update() periodically. get() returns nil until the server displays a skill level anchor. Once available it includes level, percent, maxed, and session gained XP. per_hour appears after warmup; to_next and to_60 are readable ETAs when a rate and next level are available. estimated identifies progress inferred from tab percentages, while incomplete identifies a world change or lost message history. A visible MAX label ends the ETA at that observed level.

An optional clock function supplies active seconds for scripts whose clock pauses during breaks. Each run owns its tracker; unrelated scripts do not share its counters. tablist caches visible lines for half a second and parses numbers such as 1.2k. These helpers do not open menus or configure the server's display.

Skill ETAs use the recent XP rate and current level progress. A missing-history gap restarts rate warmup. capped distinguishes a visible MAX below level 60 from reaching 60; neither state returns a further-level ETA.