Skip to content

Lua API

ESTONlA edited this page Sep 6, 2026 · 5 revisions

Lua API

Events

htf.on("fish_hooked", function(fish_name)
end)

Register one callback per event per Lua mod. Registering the same event again replaces that mod's previous callback.

Commands

htf.command("reward", function(args)
  htf.money(50)
end)

Commands are typed by the host as /reward. args is a one-indexed Lua table containing words after the command.

Scheduling

htf.after(5, function()
  htf.chat("Five seconds passed.")
end)

htf.every(60, function()
  htf.chat("Minute check.")
end)

Host Actions

htf.chat("Hello crew")
htf.money(100)

htf.chat broadcasts a prefixed game chat message. htf.money awards shared money and only acts while hosting.

Persistent Data

local score = tonumber(htf.get_data("score", "0"))
score = score + 1
htf.set_data("score", tostring(score))

Values are strings. Use Lua tonumber and tostring for numeric values.

Utility

if htf.is_host() then
  htf.log("Host is active")
end

Clone this wiki locally