Getting started
Load your first script.
Loading a script
Section titled Loading a script- Open the Scripts page in the Nyx menu.
- Click Open folder and add a
.luaor.luaufile. Names use letters, digits,_and-, up to 32 characters. - Pick the script in the Script dropdown and turn on Load.
- Autoload - loads the script every time Nyx starts.
- Reload on save - reloads it every time you save the file.
A loaded script gets its own tab at the bottom of the sidebar, with its controls and its console.
A first script
Section titled A first script-- The script's sidebar tab: a title and an iconui.sidebar("Hello", "hand")
local font = render.font("ui", 16)
events.paint:add(function() render.text(font, vector.create(20, 20, 0), color(255, 255, 255), "Hello from Nyx")end)
-- Goes to the console on the script's tabprint("loaded")Errors
Section titled ErrorsAn error stops the script. The Scripts page shows the message in red under the dropdown, and the script's tab shows the whole error with its traceback.
Examples
Section titled ExamplesWhen the folder is empty, Nyx puts three examples in it:
watermark.lua- a window with your name, the script fps and the timespectators.lua- dead teammates in a small windowhit_indicator.lua- the damage you deal, by the crosshair and over the player you hit
Their code is on the Examples page.
Nyx Lua API v1 · release commit-4b659d9c3810 · d0f772c99281