<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.aurorastation.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=TehFlaminTaco</id>
	<title>Aurora Information Uplink - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.aurorastation.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=TehFlaminTaco"/>
	<link rel="alternate" type="text/html" href="https://wiki.aurorastation.org/index.php/Special:Contributions/TehFlaminTaco"/>
	<updated>2026-06-13T20:20:56Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.aurorastation.org/index.php?title=Guide_to_NTSL2&amp;diff=11622</id>
		<title>Guide to NTSL2</title>
		<link rel="alternate" type="text/html" href="https://wiki.aurorastation.org/index.php?title=Guide_to_NTSL2&amp;diff=11622"/>
		<updated>2019-04-15T00:42:52Z</updated>

		<summary type="html">&lt;p&gt;TehFlaminTaco: Taco&amp;#039;s Changes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{wip|assign=Chada and Moondancer}}&lt;br /&gt;
&lt;br /&gt;
== Overview == &lt;br /&gt;
NTSL2+ is the programming language used aboard the station for modular computers and telecommunications, you can design a lot of interesting things with it, this guide will act as a starting place and reference for enterprising programmers aboard the Aurora.&lt;br /&gt;
&lt;br /&gt;
== Functions Reference ==&lt;br /&gt;
&lt;br /&gt;
=== Global Functions ===&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Global Functions   !! These functions can typically be used globally.&lt;br /&gt;
|-&lt;br /&gt;
| print(x)  || Prints its argument to the output and appends a new line.&lt;br /&gt;
|-&lt;br /&gt;
| write(x)  || Prints its argument to the output.&lt;br /&gt;
|-&lt;br /&gt;
| type(x)  || Returns the type of x.&lt;br /&gt;
|-&lt;br /&gt;
| tostring(x)  || Returns X as string.&lt;br /&gt;
|-&lt;br /&gt;
| tonumber(x)  || Returns X as number.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Math Library ===&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Math Library  !! An assortment of math related functions.&lt;br /&gt;
|-&lt;br /&gt;
| math.sin(x)  || Returns the sine of X. Probably uses radians, maybe.&lt;br /&gt;
|-&lt;br /&gt;
| math.cos(x)  || Returns the cosine of X.&lt;br /&gt;
|-&lt;br /&gt;
| math.tan(x)  || Returns the tangent of X&lt;br /&gt;
|-&lt;br /&gt;
| math.asin(x)  || Returns the inverse sine of X, as in, what angle gives a sine of X. X is between -1 and 1.&lt;br /&gt;
|-&lt;br /&gt;
| math.acos(x)  || Inverse cosine function, x is between -1 and 1&lt;br /&gt;
|-&lt;br /&gt;
| math.atan(x, y) OR math.atan(x)  || Inverse tangent function, either from a pair of coordinates (x and y) or a slope (x)&lt;br /&gt;
|-&lt;br /&gt;
| math.floor(x[, r])  || Rounds X to the greatest integer lower than it. Rounds to r places, or after the decimal point by default.&lt;br /&gt;
|-&lt;br /&gt;
| math.atan(x, y) OR math.atan(x)  || Inverse tangent function, either from a pair of coordinates (x and y) or a slope (x)&lt;br /&gt;
|-&lt;br /&gt;
| math.floor(x[, r])  || Rounds X to the greatest integer lower than it. Rounds to r places, or after the decimal point by default.&lt;br /&gt;
|-&lt;br /&gt;
| math.atan(x, y) OR math.atan(x)  || Inverse tangent function, either from a pair of coordinates (x and y) or a slope (x)&lt;br /&gt;
|-&lt;br /&gt;
| math.floor(x[, r])  || Rounds X to the greatest integer lower than it. Rounds to r places, or after the decimal point by default.&lt;br /&gt;
|-&lt;br /&gt;
| math.atan(x, y) OR math.atan(x)  || Inverse tangent function, either from a pair of coordinates (x and y) or a slope (x)&lt;br /&gt;
|-&lt;br /&gt;
| math.floor(x[, r])  || Rounds X to the greatest integer lower than it. Rounds to r places, or after the decimal point by default.&lt;br /&gt;
|-&lt;br /&gt;
| math.acos(x)  || Inverse cosine function, x is between -1 and 1&lt;br /&gt;
|-&lt;br /&gt;
| math.ceil(x[, r])  || Rounds X to the smallest integer greater than it. Rounds to r places, or after the decimal point by default.&lt;br /&gt;
|-&lt;br /&gt;
| math.round(x[, r])  || Rounds X according to the principle of &amp;quot;round up on 5 or above, round down otherwise&amp;quot; Rounds to r places, or after the decimal point by default.&lt;br /&gt;
|-&lt;br /&gt;
| math.max(x, y)  || Returns the largest of its two arguments.&lt;br /&gt;
|-&lt;br /&gt;
| math.clamp(low, num, high)  || If num is lower than low, returns low. If num is higher than high, returns high. Otherwise, it returns numb. Equivalent to math.max(low, math.min(high, num))&lt;br /&gt;
|-&lt;br /&gt;
| math.random(high o math.random(low, high)  || math.random(high) returns a random decimal between 0 and high. math.random(low, high) returns a random number between low and high.&lt;br /&gt;
|-&lt;br /&gt;
| math.abs(x)  || Returns the absolute value of X.&lt;br /&gt;
|-&lt;br /&gt;
| math.deg(x)  || Converts x from radians to degrees.&lt;br /&gt;
|-&lt;br /&gt;
| math.rad(x)  || Converts x from degrees to radian.&lt;br /&gt;
|-&lt;br /&gt;
| math.pi  || Pi.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== String Library ===&lt;br /&gt;
String Library&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! String Library   !! These are strings.&lt;br /&gt;
|-&lt;br /&gt;
|string.sub(string, start[, end]) || Returns the substring of string from position start to position end. If end is not specified, it is the end of the string.&lt;br /&gt;
|-&lt;br /&gt;
| string.match(string, pattern) || Searches string for instances of pattern and returns the matched value of the matched groups. If there are multiple, then it returns as a list.. Can use regex.&lt;br /&gt;
|-&lt;br /&gt;
| string.gmatch(string, pattern) || Returns an iterator function that finds all matches (similar to string.match) in a string.&lt;br /&gt;
|-&lt;br /&gt;
| string.gsub(string, pattern, replacement) || Replaces all instances of pattern with replacement. Can use regex.&lt;br /&gt;
|-&lt;br /&gt;
| string.upper(string) || Returns string but uppercase.&lt;br /&gt;
|-&lt;br /&gt;
| string.lower(string) || Returns string but lowercase.&lt;br /&gt;
|-&lt;br /&gt;
| string.reverse(string) || Reverses the string.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Term Library ===&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Term Library   !! These are terms.&lt;br /&gt;
|-&lt;br /&gt;
| term.set_foreground(r, g, b) || Sets the text color to (r, g, b). Scaled from 0 - 1.&lt;br /&gt;
|-&lt;br /&gt;
| term.get_foreground() || Returns the text color.&lt;br /&gt;
|-&lt;br /&gt;
| term.set_background(r, g, b) || Sets the background color to (r, g, b). Scaled from 0 - 1.&lt;br /&gt;
|-&lt;br /&gt;
| term.get_background() || Returns the background color.&lt;br /&gt;
|-&lt;br /&gt;
| term.set_cursor(x, y) || Sets the cursor to the position x, y. The top left is 0, 0.&lt;br /&gt;
|-&lt;br /&gt;
| term.set_cursor_x(x)|| Sets the cursor&#039;s x position to x. The left side is 0.&lt;br /&gt;
|-&lt;br /&gt;
| term.set_cursor_y(y) || Sets the cursor&#039;s y position to y. The top line is 0.&lt;br /&gt;
|-&lt;br /&gt;
| term.get_cursor(), term.get_cursor_x(), term.get_cursor_y() || Returns the cursor&#039;s position, the cursor&#039;s x position, or the cursor&#039;s y position, respectively.&lt;br /&gt;
|-&lt;br /&gt;
| term.clear() || Clears the screen with the preset background colour.&lt;br /&gt;
|-&lt;br /&gt;
| term.write() || Same as write().&lt;br /&gt;
|-&lt;br /&gt;
| term.get_size() || Gets the size of the terminal.&lt;br /&gt;
|-&lt;br /&gt;
| term.get_width() || Returns the width of the terminal.&lt;br /&gt;
|-&lt;br /&gt;
| term.get_height() || Returns the height of the terminal.&lt;br /&gt;
|-&lt;br /&gt;
| term.set_topic(x, y, width, height, topic_name) || Creates a button/link at (x, y) with width width and height height, and a corresponding topic topic_name. If topic_name begins with ?, it allows you to input text, and the corresponding topic will be &amp;quot;topic_name?input&amp;quot;. If text is written over this with write or similar, this will be cleared.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
* Variables must start with a letter, but can otherwise contain any alphanumeric character. &lt;br /&gt;
&lt;br /&gt;
Variables can be assigned to with &#039;&#039;&#039;name = value&#039;&#039;&#039;. &lt;br /&gt;
&lt;br /&gt;
Local variables can be made with &#039;&#039;&#039;var name = value&#039;&#039;&#039; or &#039;&#039;&#039;local name = value&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* Tables are values that can be indexed and can contain multiple values. They are also sometimes referred to as lists. They are constructed in the following format:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
 {key1 = value1, key2 = value2, key3 = value3...}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The final value can have a comma after it, but it is not mandatory. Tables can be indexed as &#039;&#039;&#039;name[index]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* Functions can be made in the following format: &lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
function funcname(arg1[ = defaultvalue1], arg2[ = defaultvalue2]){&lt;br /&gt;
	...code...&lt;br /&gt;
} &lt;br /&gt;
&amp;lt;/source&amp;gt; &lt;br /&gt;
&lt;br /&gt;
* Arguments can have any name a variable can take, and can be assigned default values.&lt;br /&gt;
&lt;br /&gt;
* Varargs are also usable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
	function funcname(... args){...code...}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* The various arguments provided to the function will be combined into a list and stored in the local variable args, or whatever name is provided. Brackets for arguments are optional if you have an anonymous function with one argument: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
funcname  = function arg{...code…}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* They can even be constructed in lambda calculus style:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
 (arg1[=defaultvalue1], arg2[=defaultvalue2]) =&amp;gt; {...code…}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the function style, function can be abbreviated to func. Varargs can also be used in the lambda calculus style. Single variable lambda calculus functions can be further simplified into&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
 arg =&amp;gt; {...code...}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Member functions of an object can be called in the form object.function(object, other_arguments) or object::function(other_arguments). These function identically.&lt;br /&gt;
&lt;br /&gt;
* Strings can be constructed in three ways: &amp;quot;content&amp;quot;, ‘content’, or `content`.&lt;br /&gt;
&lt;br /&gt;
* These are functionally identical except for in the last case, where expressions in square brackets will be evaluated and inserted into the string. This means that `con[expression]tent` is equivalent to instead performing two concatenation operations and one tostring call, &amp;quot;con&amp;quot; .. tostring(expression) .. &amp;quot;tent&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==== Program Flow/Structure ====&lt;br /&gt;
&lt;br /&gt;
* IF/ELSE:&lt;br /&gt;
IF/ELSE conditionals are part of the main program flow:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
	if(condition){&lt;br /&gt;
		...code…&lt;br /&gt;
	} else {&lt;br /&gt;
		...code...&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* WHEN:&lt;br /&gt;
WHEN conditionals are similar to IF conditionals, but are asynchronous and occur outside of the main program’s flow. They also expose their ‘arguments’ to the scope of its block. A typical case is the topic variable which is set in term.topic events.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
	when(event){&lt;br /&gt;
		...code…&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* WITH:&lt;br /&gt;
WITH block exposes a list/table to the scope of its block, typically used for making library referencing easier:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
	with(event){&lt;br /&gt;
		...code...&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example is used in Telecomms scripts to save the constant references to tcomm:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
	with(tcomm){&lt;br /&gt;
		when onmessage{&lt;br /&gt;
			broadcast(...)&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* FOR:&lt;br /&gt;
FOR loops have two alternate forms.&lt;br /&gt;
	List Iteration FOR Loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
	for([var] in [list]){&lt;br /&gt;
		...code...&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
	In this form, it iterates over the contents of [list], setting [var] equal to them one at a time. [list] can instead be an iterator function as well, such as string.gmatch&lt;br /&gt;
	OR&lt;br /&gt;
	Variable Iteration FOR Loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
	for([i]=[initial]; [condition]; [step]){&lt;br /&gt;
		...code...&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
	Where [i] is any variable, [initial] is the initial value, [condition] is any condition (presumably involving said variable, but not necessarily), [step] is some form of increment/decrement such as i++ or i--, ++i or --i, etc. This runs the for loop until [condition] is false, executing [step] after every iteration.&lt;br /&gt;
&lt;br /&gt;
* WHILE loop:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
	while(condition){&lt;br /&gt;
		...code...&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* SWITCH block:&lt;br /&gt;
Evaluates [condition], runs whichever code block corresponds to that condition or, if none is found, the default. If a break or return isn’t reached, the program will fall through to the next condition.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
	switch(condition){&lt;br /&gt;
		:[default OR expression]&lt;br /&gt;
			...code...&lt;br /&gt;
		:[default OR expression]&lt;br /&gt;
			...code…&lt;br /&gt;
		…&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Ternary:&lt;br /&gt;
Evaluates [expression], if [expression] is true returns [on_true], otherwise returns [on_false].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;&lt;br /&gt;
	expression ? on_true : on_false&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Eval:&lt;br /&gt;
A very powerful, very dangerous function. Produces a function from NTSL2+ code contained in a string. Format is &#039;&#039;&#039;eval [expression]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
* The Deoperator:&lt;br /&gt;
Takes the form of either &#039;&#039;&#039;@operator&#039;&#039;&#039; or &#039;&#039;&#039;@expression&#039;&#039;&#039;. In the case of an operator, returns a function that behaves like that operator (With priority to binary operators). So &#039;&#039;&#039;@+&#039;&#039;&#039; is equivalent to &#039;&#039;&#039;(a,b)=&amp;gt;a+b&#039;&#039;&#039;, though runs slightly faster. When an expression is used, this functions as a niladic operator, so is equivalent to &#039;&#039;&#039;()=&amp;gt;expression&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;+&#039;&#039;&#039;, &#039;&#039;&#039;-&#039;&#039;&#039;, &#039;&#039;&#039;*&#039;&#039;&#039;, &#039;&#039;&#039;/&#039;&#039;&#039;, &#039;&#039;&#039;^&#039;&#039;&#039;, &#039;&#039;&#039;%&#039;&#039;&#039;, &#039;&#039;&#039;and&#039;&#039;&#039;/&#039;&#039;&#039;&amp;amp;&amp;amp;&#039;&#039;&#039;, &#039;&#039;&#039;or&#039;&#039;&#039;/&#039;&#039;&#039;||&#039;&#039;&#039;, &#039;&#039;&#039;&amp;lt;&#039;&#039;&#039;, &#039;&#039;&#039;&amp;gt;&#039;&#039;&#039;, &#039;&#039;&#039;&amp;lt;=&#039;&#039;&#039;, &#039;&#039;&#039;&amp;gt;=&#039;&#039;&#039;, &#039;&#039;&#039;==&#039;&#039;&#039;, and &#039;&#039;&#039;!=&#039;&#039;&#039; all operate as expected.&lt;br /&gt;
&lt;br /&gt;
Concatenation is performed by &#039;&#039;&#039;[expr1] .. [expr2]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The length of the text representation of a string, or the number of elements in a list, can be found with &#039;&#039;&#039;#[expression]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Logical negation is performed with &#039;&#039;&#039;![expression]&#039;&#039;&#039;, binary negation is performed with &#039;&#039;&#039;~[expression]&#039;&#039;&#039;, decimal unary negation is performed with &#039;&#039;&#039;-[expression]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Integer division can be performed with &#039;&#039;&#039;[expression] // [expression]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Modulo can be performed with &#039;&#039;&#039;[expression] % [expression]&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
Bitwise operators are also available, such as &#039;&#039;&#039;|&#039;&#039;&#039;, &#039;&#039;&#039;&amp;amp;&#039;&#039;&#039;, &#039;&#039;&#039;&amp;lt;&amp;lt;&#039;&#039;&#039;, &#039;&#039;&#039;&amp;gt;&amp;gt;&#039;&#039;&#039;, &#039;&#039;&#039;&amp;amp;&#039;&#039;&#039;, and &#039;&#039;&#039;[expression] ~ [expression]&#039;&#039;&#039; (xor, do not confuse with unary base 2 negation)&lt;/div&gt;</summary>
		<author><name>TehFlaminTaco</name></author>
	</entry>
	<entry>
		<id>https://wiki.aurorastation.org/index.php?title=User:TehFlaminTaco&amp;diff=10956</id>
		<title>User:TehFlaminTaco</title>
		<link rel="alternate" type="text/html" href="https://wiki.aurorastation.org/index.php?title=User:TehFlaminTaco&amp;diff=10956"/>
		<updated>2018-12-29T04:26:44Z</updated>

		<summary type="html">&lt;p&gt;TehFlaminTaco: Created page with &amp;quot;It&amp;#039;s Taco. Hi.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;It&#039;s Taco. Hi.&lt;/div&gt;</summary>
		<author><name>TehFlaminTaco</name></author>
	</entry>
</feed>