Skip to content

Creating your own plug-in

Create a new .lua file in the plug-ins directory and add the required plugin table. Then implement the lifecycle callbacks you need.

Minimum skeleton

plugin = {
    name = "My Plugin",
    version = "1.0.0",
    description = "Short description"
}

function onLoad()
    hyperion.log("Loaded My Plugin")
end

function onTick()
    if not hyperion.globals.inGame() then
        return
    end
end

Best practices

  • Keep onTick() lightweight and avoid heavy loops every frame.
  • Use hyperion.globals.inGame() to guard game-only work.
  • Always validate Source2 objects with isValid() before use.
  • Store state in local variables instead of globals when possible.
  • Use onMenu() to expose settings with hyperion.ui.*.