Skip to content

DefinitionFile

minerkid08 edited this page Aug 20, 2025 · 1 revision

Definition File

By default your editor will not be able to auto complete functions that you have defined.

Open def.lua from the quick start.

In it you should see something like this.

---@class Opmode
---@field name string
---@field init function?
---@field start function?
---@field update function?

---@param opmode Opmode
function addOpmode(opmode) end

In here you can define your own functions.

-- define a function with no arguments
function funcName() end

-- define a function that returns a bool 
---@return boolean
function funcName() end

-- define a function that takes a string as a parameter
---@param arg string 
function funcName(arg) end

If you placed your functions inside of a table you can define it like this.

local table = {};

function table.funcName() end

If your function is part of a class you can define it in a similar way

---@class Class
local Class = {};

function Class:funcName() end

For information check out this page here.

Clone this wiki locally