Skip to content

Getting Started

Learn how to structure your scripts for Violet.

Script Structure

All scripts require a plugin table at the top with metadata. The core reads this file once on injection or reload.

lua
plugin = {
    name = "Test Console Logger",
    version = "1.0.0",
    author = "Seven",
    description = "Logs 'Test' to console on every tick",
    load = true
}

function on_tick()
    local player = core.object_manager.get_local_player()
    if not player or not player:is_valid() then
        return
    end

    core.log("Hello, World!")
end

Plugin Metadata

Required fields in the plugin table:

  • name - Script name
  • version - Version string
  • author - Author name
  • description - Brief description
  • load - Auto-load on injection (true/false)

Execution Model

  • The core reads the main file once during injection or reload
  • Code outside callbacks executes once during load
  • Code inside callbacks executes when triggered by the core
  • All script logic must be in the main file

INFO

For callback details, see the Core documentation.