Skip to content

Getting started

Nak edited this page Sep 11, 2022 · 3 revisions

NikNaks is build to work with multiple addons. It should only be loaded once, as some features like the map-geometry can be a memory-hog. That is why it is build as a module.

Installing

NikNaks should be treated as an addon you simply add to your collection.


How to use

You can use the require function load modules, in this case NikNaks.

require("niknaks")

The require function will ensure NikNaks have loaded at least once. If NikNaks are not installed, it will simply error.


The "NikNaks." shortcut

Every function and variable in NikNaks starts with "NikNaks." infront. For example:

require("niknaks")
NikNaks.AutoInclude("somefile/sv_a.lua")
NikNaks.AutoInclude("somefile/sh_b.lua")
NikNaks.AutoInclude("somefile/sh_c.lua")
NikNaks.AutoInclude("somefile/cl_d.lua")
local static_props = NikNaks.CurrentMap:GetStaticProps()
local entities = NikNaks.CurrentMap:GetEntities()

This is to ensure compatibility with other mods, that might share the same variables-names. However this can be tedious to write, so NikNaks feature a "namespace" function.

require("niknaks")
NikNaks() -- Everything after this line, don't need "NikNaks." infront.
AutoInclude("somefile/sv_a.lua")
AutoInclude("somefile/sh_b.lua")
AutoInclude("somefile/sh_c.lua")
AutoInclude("somefile/cl_d.lua")
local static_props = CurrentMap:GetStaticProps()
local entities = CurrentMap:GetEntities()```

Nik Naks Wiki


Features:

Clone this wiki locally