List of Nasal extension functions: Difference between revisions

Jump to navigation Jump to search
m
→‎addcommand(): & logprint() (both are James' work)
m (→‎addcommand(): & logprint() (both are James' work))
Line 45: Line 45:
=== <tt>addcommand()</tt> ===
=== <tt>addcommand()</tt> ===


Add a fgcommand which can be used like a regular fgcommand (global scope, etc.). First argument is the name, second is the function to run. Note that this fgcommand will always return true!
Add a fgcommand which can be used like a regular fgcommand (global scope, etc.). First argument is the name, second is the function to run. Note that this fgcommand will always return true! Inside the callback/function one can use either cmdarg() to retrieve the arguments or use the first argument passed to the function (since they will be the same).
 
=== <tt>logprint()</tt> ===
 
The first argument should be a number specifying the priority (i.e. matching a sgDebugPriority: 0 for warn, etc.) and the rest of the arguments get concatenated to form the message for sglog.log() (basically the builtin logging mechanism). Returns the length of the message in bytes.


=== <tt>print()</tt> ===
=== <tt>print()</tt> ===
395

edits

Navigation menu