Najova

DocsBuilt-in functions

Modules

Split a project into files, and share functions between them.

$use

$use[module;name]

Loads a module (a .naja file or an extension) once and names what it shares: $use[tools] then $call[tools.greet;Sam].

use.najanot run here
$-- tools.naja beside this script has $function[greet;who]
$use[tools]
$call[tools.greet;Sam]
Shown without running: it needs a second file. See the Modules guide.

$private

$private[names...]

Keeps names of a module to itself; $use gets all its other top names.

private.najanot run here
$-- in tools.naja
$private[helper]
$function[helper]
  $return[42]
$endfunction
$function[answer]
  $return[$helper]
$endfunction
Scripts that $use[tools] get answer, not helper.