Skip to content

Scripts

Script Environment

All of Nn api is generally available within it's own lua environment which is passed along to any loaded script

Any Api that currently is also available in _G is ONLY there for testing purposes and can be removed at any point

local Nn = ...

-- exposing to _G for purely testing purposes
_G.NnEnv = getfenv(1) or Nn

Script Loading

Nn provides the following api for loading scripts besides the files already starting with an _ (underscore) inside your /scripts subdirectory

For example: /scripts/_runme.lua will execute every time you are in-game at client load / reload

Require

local Nn, arg1, arg2 = ... -- grab additional Require arguments passed if any
Require('/scripts/test.lua',arg1, arg2, ...) -- we can pass additional arguments that the file can access if we desire
Require('/scripts/obf.nn')
Require('/scripts/mine',arg1, arg2, ...) -- this will load file mine.nn or mine.lua whichever it finds existing

Deprecated

RequireFileEnc / RequireLuaFile

-- same arguments as Require above
RequireFileEnc() -- only loads .nn files
RequireLuaFile() -- only loads .lua files