Kura
Early Access: Documentation is actively evolving and may change without notice.

Lua Types

Set up Lua Language Server for the Kura workspace.

Follow these steps to get intellisense and type annotations for FiveM natives, the Kura runtime, and your generated KuraDB schema.

Setup

Install Lua Language Server

Install the Lua extension by sumneko.

Install fivem-lls-addon

Create a folder to hold your Lua addons, then clone the FiveM addon into it. Pick a path outside your server resources folder.

mkdir C:\lua-addons
git clone https://github.com/overextended/fivem-lls-addon.git C:\lua-addons\fivem-lls-addon

Common locations: C:\lua-addons or C:\Users\<you>\lua-addons.

mkdir -p ~/lua-addons
git clone https://github.com/overextended/fivem-lls-addon.git ~/lua-addons/fivem-lls-addon

This adds types for FiveM natives and globals.

Add .luarc.json to your workspace

Create .luarc.json at your workspace root (resources/[core]/). Set userThirdParty to the parent folder of fivem-lls-addon, not the addon itself.

{
  "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
  "runtime": {
    "version": "Lua 5.4"
  },
  "workspace": {
    "checkThirdParty": "Apply",
    "userThirdParty": ["C:/lua-addons"],
    "library": [
      "./kura-lib/init.lua",
      "./kuradb/lib/KuraDB.lua",
      "./kuradb/lib/QueryBuilder.lua",
      "./kuradb/lib/schema.generated.lua"
    ]
  },
  "diagnostics": {
    "globals": ["Citizen", "exports", "kura", "op", "promise"]
  }
}

Use forward slashes in JSON paths even on Windows.

{
  "$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
  "runtime": {
    "version": "Lua 5.4"
  },
  "workspace": {
    "checkThirdParty": "Apply",
    "userThirdParty": ["/home/<you>/lua-addons"],
    "library": [
      "./kura-lib/init.lua",
      "./kuradb/lib/KuraDB.lua",
      "./kuradb/lib/QueryBuilder.lua",
      "./kuradb/lib/schema.generated.lua"
    ]
  },
  "diagnostics": {
    "globals": ["Citizen", "exports", "kura", "op", "promise"]
  }
}

Replace <you> with your username, or use $HOME/lua-addons.

Add .luarc.json to .gitignore and commit a .luarc.default.json so each developer can set their own addon path.

Generate your schema types

From the kuradb resource directory:

kuradb generate --types-only

This writes kuradb/lib/schema.generated.lua, which gives you autocomplete for your tables, columns, and row types.

Re-run this command whenever your schema changes.

Verify

Open any Lua file in your workspace and check that these resolve:

local users = kura.db.tables.users

---@type UsersRow[]
local rows = kura.db.select()
  :from(users)
  :where(op.eq(users.id, 1))
  :await()

print(rows[1].username)

You should get autocomplete on kura.db, op.*, and the row fields generated from your schema.

Troubleshooting

  • Open resources/[core] as the workspace root, not a subfolder
  • userThirdParty must point to the parent of fivem-lls-addon, not the addon itself
  • If row types are missing, run kuradb generate --types-only and reload the editor

On this page