Server code
Plugins
A plugin is Luau that runs when something asks for it: a client calls a function, a player signs up, a timer fires. A run starts fresh every time, nothing stays between runs except what it writes.
Functions that clients call
ansekai.rpc("dig", function(ctx, params)
local pickaxes = ansekai.data.get(ctx.player, "pickaxe") or 0
return { gold = ansekai.data.increment(ctx.player, "gold", 1 + pickaxes) }
end)const { gold } = await ansekai.plugins.call("dig");ctx.player is the id of the player who called. A function with { public = true } can be called without a player, ctx.player is nil then. The answer is anything JSON can hold, up to 64 KB. A name belongs to one plugin of the game, two plugins can't offer the same function.
Hooks
ansekai.on("player.registered", function(ctx, event)
ansekai.data.set(event.player, "gold", 20)
end)| Hook | When |
|---|---|
player.registered | After a player signs up |
player.signed_in | After a player signs in |
Timers
ansekai.every("boss", 60 * 60, function()
ansekai.realtime.set("events/boss", { name = "Ember Wyrm" })
end)A timer runs every 60 seconds at the most often, and every 30 days at the least.
Writing and publishing
The editor of a plugin saves drafts, Publish makes the code live at once. The last 30 versions are kept, Go back makes an old one live again. A game has up to 50 plugins, a plugin is up to 64 KB of code.
Try it in the panel runs the text in the editor on the real data of the game, shows the answer and the logs, then undoes every change.
Own connection
A plugin can keep connection settings of its own, separate from the Plugins module, for example UDP for one fast function. The SDK follows them by itself. See Connections.
Cost
Every plan includes runs each month, more cost $0.20 a million. A run also pays for its memory, $0.00005 for a MB held a minute, and its CPU time, $0.00002 a second. Waiting for the database is free.
Updated November 21, 2026