Neuridion API Reference

Complete reference for all 37 standard library modules.

Core

Core 🔢Math 💻System 🖥Console

Data & Storage

{ }JSON 📊CSV </>XML 🗃Database 💾Storage .*RegEx

Files & Network

📁FileAndFolder 🌐Network 📦Compression Email

User Interface

🗒Form 📈Chart 🎨Graphics 🖥Screen 📄PDF QRCode

Text & Language

🌏Translate 🔄Encoding 🗣Speech 📋Clipboard

Date, Time & Security

📅DateAndTime 📆Calendar 🔒Crypto

AI, Media & Hardware

🧠AI 🎵Audio 🎷Synth 🔔Notification Hardware 📡Bluetooth 📍Location 👤Contacts 🎨Color Shell

Core

Global functions available without a module prefix.

FunctionParametersReturnsDescription
Print()values...Output text to the console
TypeOf()valueStringGet the type name of a value
Array()items...ArrayCreate an array from arguments
IsNil()valueBooleanCheck if a value is Nil
Core.UUID()StringGenerate a random UUID string

Math

Mathematical functions, constants, and random number generation.

Properties

PropertyTypeDescription
Math.PIDoublePi (3.14159...)
Math.EDoubleEuler's number (2.71828...)
Math.InfinityDoublePositive infinity
Math.NaNDoubleNot a Number

Methods

MethodParametersReturnsDescription
Sqrt(x)numberDoubleSquare root
Sin(x)radiansDoubleSine
Cos(x)radiansDoubleCosine
Tan(x)radiansDoubleTangent
Asin(x)valueDoubleArc sine
Acos(x)valueDoubleArc cosine
Atan(x)valueDoubleArc tangent
Atan2(y, x)y, xDoubleTwo-argument arc tangent
Log(x)numberDoubleNatural logarithm
Log10(x)numberDoubleBase-10 logarithm
Exp(x)numberDoublee raised to x
Pow(base, exp)base, exponentDoublePower
Floor(x)numberDoubleRound down
Ceil(x)numberDoubleRound up
Round(x [, decimals])number [, places]DoubleRound to nearest (optional decimal places)
Abs(x)numberNumberAbsolute value
Min(a, b)a, bNumberSmaller of two
Max(a, b)a, bNumberLarger of two
Sign(x)numberIntegerSign: -1, 0, or 1
Random()DoubleRandom 0.0–1.0
RandomInt(min, max)min, maxIntegerRandom integer in range

System

System information and process control.

Properties

PropertyTypeDescription
System.PlatformStringAlways "macOS"
System.OSVersionStringmacOS version string
System.UserNameStringCurrent user name

Methods

MethodParametersReturnsDescription
Sleep(ms)millisecondsPause execution
Exit([code])[exit code]Terminate the program
Environment(name)variable nameStringRead environment variable
CurrentTimeMillis()IntegerMilliseconds since epoch

Console

Console I/O for reading input and writing formatted output.

MethodParametersReturnsDescription
Write(values...)valuesPrint without newline
WriteLine(values...)valuesPrint with newline
Error(msg)messagePrint [ERROR] message (red)
Warn(msg)messagePrint [WARN] message (orange)
Info(msg)messagePrint [INFO] message (blue)
Debug(msg)messagePrint [DEBUG] message (gray)
Table(data)2D arrayPrint formatted table
ReadLine([prompt])[prompt text]StringRead user input
Clear()Clear console output

JSON

Parse, create, and manipulate JSON data.

MethodParametersReturnsDescription
Parse(text)JSON stringObject/ArrayParse JSON string to value
Stringify(value [, pretty])value [, Boolean]StringConvert value to JSON string
IsValid(text)stringBooleanCheck if string is valid JSON
Format(text)JSON stringStringPretty-print JSON
ReadFile(path)file pathObject/ArrayLoad and parse a JSON file
WriteFile(path, value [, pretty])path, value [, Bool]Write value as JSON to file

CSV

Read and write CSV (Comma-Separated Values) data.

MethodParametersReturnsDescription
Parse(text [, delimiter])CSV string [, separator]ArrayParse CSV string to 2D array
Read(path [, delimiter])file path [, separator]ArrayRead CSV file to 2D array
Write(path, data [, delimiter])path, 2D array [, separator]Write 2D array to CSV file
ToString(data [, delimiter])2D array [, separator]StringConvert 2D array to CSV string

XML

Parse, create, and manipulate XML documents.

MethodParametersReturnsDescription
ParseString(text)XML stringXmlDocumentParse XML string
LoadFromFile(path)file pathXmlDocumentLoad XML from file
Create(rootName)root element nameXmlDocumentCreate new XML document

XmlDocument Object

MethodReturnsDescription
.GetRootElement()XmlElementGet the root element
.ToString()StringSerialize to XML string
.SaveToFile(path)Save to file

XmlElement Object

Method/PropertyReturnsDescription
.NameStringElement tag name
.TextContentStringText content
.GetChildren()ArrayGet child elements
.GetChildByName(name)XmlElementFind child by tag name
.GetAttribute(name)StringGet attribute value
.SetAttribute(name, value)Set attribute
.SetTextContent(text)Set text content
.AddChild(element)Append child element
.RemoveChild(element)Remove child element

Database

SQLite database access.

MethodParametersReturnsDescription
Open(path)file pathConnectionOpen or create a SQLite database
InMemory()ConnectionCreate in-memory database

Connection Object

MethodParametersReturnsDescription
.Execute(sql, params...)SQL [, values]IntegerExecute SQL, return affected rows
.Query(sql, params...)SQL [, values]ArrayQuery and return rows as array of objects
.Scalar(sql, params...)SQL [, values]ValueReturn first column of first row
.Close()Close the connection
.TableExists(name)table nameBooleanCheck if table exists
.LastInsertId()IntegerLast inserted row ID
.Changes()IntegerRows changed by last statement

Storage

Persistent key-value storage (per project).

MethodParametersReturnsDescription
Set(key, value)key, valueStore a value
Get(key)keyValueRetrieve a stored value
Has(key)keyBooleanCheck if key exists
Remove(key)keyDelete a stored value
GetAll()ObjectGet all key-value pairs
Clear()Delete all stored values

RegEx

Regular expression matching and manipulation.

MethodParametersReturnsDescription
IsMatch(pattern, text)pattern, textBooleanTest if text matches pattern
Match(pattern, text)pattern, textArrayReturn all matches
Replace(pattern, text, replacement)pattern, text, replacementStringReplace matches
Split(pattern, text)pattern, textArraySplit text by pattern
Escape(text)textStringEscape special regex characters

FileAndFolder

File system operations: read, write, copy, move, and browse files and folders.

Properties

PropertyDescription
HomeDirectoryUser home directory
TempDirectoryTemporary directory
DesktopDirectoryDesktop path
DocumentsDirectoryDocuments path
DownloadsDirectoryDownloads path
CurrentDirectoryCurrent working directory

Methods

MethodParametersReturnsDescription
ReadFile(path)pathStringRead entire file as text
WriteFile(path, text)path, contentWrite text to file
AppendLine(path, text)path, lineAppend a line to file
FileExists(path)pathBooleanCheck if file exists
DeleteFile(path)pathDelete a file
CopyFile(src, dst)source, destinationCopy a file
MoveFile(src, dst)source, destinationMove a file
RenameFile(path, newName)path, new nameRename a file
GetFileSize(path)pathIntegerFile size in bytes
Open(path)pathFileHandleOpen file for read/write
CreateFolder(path)pathCreate directory
DeleteFolder(path)pathDelete directory
FolderExists(path)pathBooleanCheck if folder exists
ListFiles(path)directory pathArrayList files in directory
ListFolders(path)directory pathArrayList subdirectories
ListAll(path)directory pathArrayList all items
GetFileName(path)pathStringExtract file name
GetExtension(path)pathStringExtract file extension
GetDirectory(path)pathStringExtract parent directory
Combine(path1, path2)base, relativeStringJoin paths
ChooseFile([filter])[extension filter]StringShow file picker dialog
ChooseFolder()StringShow folder picker dialog

FileHandle Object

Method/PropertyReturnsDescription
.PathStringFile path
.IsOpenBooleanWhether file is open
.ReadAll()StringRead entire file
.ReadLine()StringRead next line
.Write(text)Write text (overwrite)
.Append(text)Append text
.Close()Close the file

Network

HTTP requests, TCP connections, and sessions.

MethodParametersReturnsDescription
Get(url [, headers])URL [, Object]ResponseHTTP GET request
Post(url, body [, headers])URL, body [, Object]ResponseHTTP POST request
Put(url, body [, headers])URL, body [, Object]ResponseHTTP PUT request
Delete(url [, headers])URL [, Object]ResponseHTTP DELETE request
Download(url, path)URL, file pathBooleanDownload file to disk
Session()SessionCreate persistent session
TCP.Connect(host, port [, timeout])host, port [, seconds]TCPConnectionOpen TCP connection

Response Object

PropertyTypeDescription
.StatusCodeIntegerHTTP status code
.BodyStringResponse body
.OKBooleanTrue if 200-299
.HeadersObjectResponse headers

Compression

Zip/unzip files and folders.

MethodParametersReturnsDescription
ZipFolder(folder, zipPath)source folder, output zipBooleanCompress a folder
ZipFile(file, zipPath)source file, output zipBooleanCompress a single file
Unzip(zipPath, folder)zip file, output folderBooleanExtract entire archive
UnzipFile(zipPath, fileName, outPath)zip, file name, outputBooleanExtract single file
ListArchiveContent(zipPath)zip fileArrayList files in archive
CompressBytes(data [, algo])string [, algorithm]StringCompress data in memory
DecompressBytes(data [, algo])string [, algorithm]StringDecompress data in memory

Email

Send and receive email via SMTP and IMAP.

MethodParametersReturnsDescription
Send(to, subject, body [, from, html])to, subject, body [, from, html]BooleanSend email via SMTP
Create()MailCreate composable email
SMTP(host, port, user, pass)credentialsSMTPCreate SMTP connection
IMAP(host, port, user, pass)credentialsIMAPCreate IMAP connection

Mail Object

Property/MethodDescription
.From, .To, .CC, .BCCAddress fields
.Subject, .Body, .HTMLContent fields
.AddAttachment(path)Attach a file
.Send()Send the email

Form

Create native macOS windows and dialogs with controls.

MethodParametersReturnsDescription
Window(title, width, height [, options])title, w, h [, Object]FormWindowCreate a form window

FormWindow Controls

All controls use unified signature: Add*(name, content, x, y, width [, options])

MethodContent TypeDescription
.AddLabel()StringStatic text label
.AddButton()StringClickable button
.AddTextField()StringSingle-line text input
.AddTextArea()StringMulti-line text input
.AddCheckBox()StringCheckbox toggle
.AddRadioButton()StringRadio button
.AddComboBox()ArrayDropdown selection
.AddListBox()ArrayScrollable list
.AddProgressBar()NumberProgress indicator
.AddSlider()NumberSlider control
.AddImageView()String (path)Image display
.AddGroupBox()StringGroup container
.AddSeparator(name, x, y, w)Horizontal separator
.AddTable()2D ArrayData table

Window Methods

MethodReturnsDescription
.Show()ObjectShow modal dialog, return all values
.Open()Open for event loop mode
.WaitForEvent()ObjectWait for next event
.Close()Close the window
.GetControl(name)ControlGet live control reference

Chart

Create bar, line, pie, and scatter charts.

MethodParametersReturnsDescription
Bar(labels, values)Array, ArrayChartObjectCreate bar chart
Line(labels, values)Array, ArrayChartObjectCreate line chart
Pie(labels, values)Array, ArrayChartObjectCreate pie chart
Scatter(labels, values)Array, ArrayChartObjectCreate scatter chart

ChartObject

Property/MethodDescription
.TitleChart title (read/write)
.SetSize(w, h)Set chart dimensions
.SetColor(r, g, b)Set chart color (RGB integers 0–255)
.Show()Display in a window
.SaveToFile(path)Save chart as PNG
.ToPicture()Convert to Picture object

Graphics

Create and manipulate images with drawing operations.

MethodParametersReturnsDescription
CreatePicture(width, height)width, heightPictureCreate a blank image

Picture Object

MethodParametersDescription
.DrawRectangle(x, y, w, h)x, y, width, heightDraw rectangle outline
.FillRectangle(x, y, w, h)x, y, width, heightFill rectangle
.DrawEllipse(x, y, w, h)x, y, width, heightDraw ellipse outline
.FillEllipse(x, y, w, h)x, y, width, heightFill ellipse
.DrawLine(x1, y1, x2, y2)start x/y, end x/yDraw a line
.DrawText(text, x, y)text, x, yDraw text
.DrawPicture(pic, x, y)picture, x, yOverlay another picture
.SetColor(color)Color or r,g,bSet stroke color
.SetFillColor(color)Color or r,g,bSet fill color
.SetLineWidth(w)widthSet line thickness
.SetFont(name, size)font name, sizeSet text font
.SaveToFile(path)file pathSave as PNG
.ToPicture()Get as Picture value
.DetectText([lang])[language]Detect text via Vision (AI)
.DetectObjects()Detect objects via Vision (AI)
.DetectFaces()Detect faces via Vision (AI)

Screen

Screen information, mouse position, and screenshots.

MethodParametersReturnsDescription
Width()IntegerMain screen width
Height()IntegerMain screen height
ScaleFactor()DoubleRetina scale factor
DarkMode()BooleanIs dark mode active
Displays()ArrayAll connected displays
MouseX()IntegerMouse X position
MouseY()IntegerMouse Y position
Screenshot()PictureCapture entire screen
ScreenshotRegion(x, y, w, h)x, y, w, hPictureCapture screen region
ScreenshotToFile(path)file pathBooleanSave screenshot to file
PixelColor(x, y)x, yColorGet pixel color

PDF

Create and manipulate PDF documents.

MethodParametersReturnsDescription
Create([width, height])[w, h]PDFCreate new PDF
Open(path)file pathPDFOpen existing PDF

PDF Object

MethodParametersDescription
.AddPage([w, h])[width, height]Add a new page
.SetFont(name, size)font, sizeSet text font
.DrawText(x, y, text)x, y, textDraw text on page
.SaveToFile(path)pathSave PDF to file
.AddPageNumbers([format])[format]Add page numbers

QRCode

Generate and read QR codes.

MethodParametersReturnsDescription
Generate(text [, size])content [, pixel size]PictureGenerate QR code image
Read(picture)pictureStringRead QR code from Picture object

Translate

Text translation using Apple Translation or MyMemory API.

MethodParametersReturnsDescription
Text(text, targetLang [, sourceLang])text, target lang [, source lang]StringTranslate text (source language is optional)
DetectLanguage(text)textStringDetect language of text
DetectLanguages(text [, count])text [, max results]ArrayDetect multiple possible languages

Encoding

Base64, hex, URL encoding, and number base conversions.

MethodParametersReturnsDescription
Base64Encode(text)textStringEncode to Base64
Base64Decode(text)Base64 stringStringDecode from Base64
HexEncode(text)textStringEncode to hex
HexDecode(text)hex stringStringDecode from hex
URLEncode(text)textStringURL-encode text
URLDecode(text)encoded textStringURL-decode text
HTMLEscape(text)textStringEscape HTML entities
HTMLUnescape(text)textStringUnescape HTML entities
ToBinary(n)integerStringConvert to binary string
FromBinary(text)binary stringIntegerParse binary string
ToOctal(n)integerStringConvert to octal
FromOctal(text)octal stringIntegerParse octal string
ToHex(n)integerStringConvert to hex
FromHex(text)hex stringIntegerParse hex string
ToBase(n, base)number, baseStringConvert to arbitrary base
FromBase(text, base)string, baseIntegerParse from arbitrary base
Char(code)ASCII codeStringCharacter from code point
ASCII(char)characterIntegerCode point of character

Speech

Text-to-speech using the system voice.

MethodParametersReturnsDescription
Say(text [, voice])text [, voice name]Speak text aloud
GetVoices()ArrayList available voices
SetVoice(name)voice nameSet default voice
SetRate(rate)speed (0–300)Set speech rate
Stop()Stop speaking

Clipboard

System clipboard access.

MethodParametersReturnsDescription
GetText()StringRead clipboard text
SetText(text)textCopy text to clipboard
HasText()BooleanCheck if clipboard has text
Clear()Clear clipboard

DateAndTime

Date and time creation, formatting, and arithmetic.

MethodParametersReturnsDescription
Now()DateCurrent date and time
Today()DateToday at midnight
Timestamp()IntegerUnix timestamp (seconds)
TimestampMillis()IntegerUnix timestamp (milliseconds)
Create(y, m, d [, h, min, s])year, month, day [, ...]DateCreate specific date
Parse(text, format)string, formatDateParse date from string
DaysBetween(d1, d2)date, dateIntegerDays between two dates
SecondsBetween(d1, d2)date, dateIntegerSeconds between two dates
IsLeapYear(year)yearBooleanCheck if leap year
DaysInMonth(year, month)year, monthIntegerDays in given month

Date Object

Property/MethodTypeDescription
.Year, .Month, .DayIntegerDate components
.Hour, .Minute, .SecondIntegerTime components
.DayOfWeekIntegerDay of week (1=Sun)
.DayOfWeekNameStringDay name (e.g. "Monday")
.MonthNameStringMonth name (e.g. "January")
.AddDays(n)DateAdd days
.AddHours(n)DateAdd hours
.AddMinutes(n)DateAdd minutes
.AddMonths(n)DateAdd months
.AddYears(n)DateAdd years
.Format(fmt)StringFormat as string (e.g. "yyyy-MM-dd")
.ToString()StringDefault string representation

Calendar

Access macOS Calendar events and Reminders.

MethodParametersReturnsDescription
Today()ArrayToday's events
Events(from, to)start date, end dateArrayEvents in date range
NextEvent()EventNext upcoming event
Busy(date)dateBooleanCheck if date has events
CreateEvent(options)ObjectEventCreate a calendar event
DeleteEvent(event)eventBooleanDelete an event
List()ArrayList all calendars
Reminders()ArrayGet all reminders
CreateReminder(options)ObjectReminderCreate a reminder

Crypto

Cryptographic hashing, HMAC, and encryption.

MethodParametersReturnsDescription
SHA256(text)textStringSHA-256 hash
SHA384(text)textStringSHA-384 hash
SHA512(text)textStringSHA-512 hash
HMAC_SHA256(text, key)text, keyStringHMAC-SHA256
HMAC_SHA512(text, key)text, keyStringHMAC-SHA512
VerifyHMAC(text, key, hash)text, key, expectedBooleanVerify HMAC
GenerateKey()StringGenerate AES-GCM key
Encrypt(text, key)plaintext, keyStringAES-GCM encrypt
Decrypt(text, key)ciphertext, keyStringAES-GCM decrypt
EncryptChaCha(text, key)plaintext, keyStringChaCha20-Poly1305 encrypt
DecryptChaCha(text, key)ciphertext, keyStringChaCha20-Poly1305 decrypt
RandomToken(length)byte lengthStringRandom hex token
HashFile(path)file pathStringSHA-256 hash of file

AI

AI text generation via Apple Intelligence, Claude, Google, or OpenAI.

MethodParametersReturnsDescription
Apple()AppleAIApple Intelligence (on-device)
Claude([apiKey [, model]])[key, model]ClaudeAIAnthropic Claude
Google([apiKey [, model]])[key, model]GoogleAIGoogle Gemini
OpenAI([apiKey [, model]])[key, model]OpenAIOpenAI GPT

AI Provider Object

MethodParametersReturnsDescription
.Generate(prompt)prompt textStringGenerate text
.GenerateWith(system, prompt)system prompt, user promptStringGenerate with system instruction
.Summarize(text)textStringSummarize text
.Translate(text, lang)text, target languageStringTranslate text
.IsAvailable()BooleanCheck availability (Apple only)

Audio

Audio playback and recording.

MethodParametersReturnsDescription
LoadSound(path)file pathAudioPlayerLoad audio file
StartRecording(path)output pathAudioRecorderStart recording audio

AudioPlayer Object

Method/PropertyDescription
.Play()Start playback
.Pause()Pause playback
.Resume()Resume playback
.Stop()Stop playback
.Seek(seconds)Seek to position
.SetVolume(level)Set volume (0.0–1.0)
.SetLooping(bool)Enable/disable looping
.GetDuration()Get total duration
.GetPosition()Get current position
.Release()Release resources
.IsPlayingWhether currently playing
.DurationTotal duration in seconds

Synth

Synthesizer for generating tones and sounds.

MethodParametersReturnsDescription
PlayNote(freq [, duration])frequency [, seconds]Play a single note
PlaySequence(notes, duration)freq array, secondsPlay a sequence of notes
SweepUp(startHz, endHz, duration)start freq, end freq, secondsPlay ascending frequency sweep
SweepDown(startHz, endHz, duration)start freq, end freq, secondsPlay descending frequency sweep
Noise(duration)secondsPlay white noise
Stop()Stop all playback
SetVolume(level)volume (0.0–1.0)Set output volume
SetAttack(seconds)secondsSet attack time
SetDecay(seconds)secondsSet decay time
SetSustain(level)level (0.0–1.0)Set sustain level
SetRelease(seconds)secondsSet release time

Notification

macOS system notifications.

MethodParametersReturnsDescription
Send(title, message [, sound])title, body [, sound name]Show system notification
SendWithSubtitle(title, subtitle, msg)title, subtitle, bodyNotification with subtitle

Hardware

System hardware information.

MethodParametersReturnsDescription
CPU()ObjectCPU info (Model, Cores, PhysicalCores)
Memory()ObjectRAM info (Total, Available, Used, Pressure)
Battery()ObjectBattery (Level, IsCharging, PowerSource, CycleCount)
Disk()ObjectBoot disk (Total, Free, Used)
DiskFor(path)pathObjectDisk info for path
Uptime()IntegerSystem uptime in seconds
ThermalState()StringThermal state (Nominal/Fair/Serious/Critical)
MacModel()StringMac model identifier
Displays()ArrayConnected displays

Bluetooth

Bluetooth Low Energy (BLE) device scanning and communication.

MethodParametersReturnsDescription
IsAvailable()BooleanCheck if Bluetooth is on
Scan(seconds)durationArrayScan for BLE devices
Connect(device)device objectConnectionConnect to device
Disconnect(connection)connectionBooleanDisconnect from device

Connection Object

MethodParametersDescription
.Discover()Discover services & characteristics
.Read(serviceUUID, charUUID)UUIDsRead characteristic value (hex)
.Write(serviceUUID, charUUID, hex)UUIDs, hex dataWrite to characteristic
.Disconnect()Disconnect

Location

GPS location and geocoding.

MethodParametersReturnsDescription
Current()LocationGet current GPS location
SearchAddress(address)address stringLocationGeocode address to coordinates
SearchCoordinates(lat, lon)lat, lonLocationReverse geocode
DistanceBetween(lat1, lon1, lat2, lon2)coordsDoubleDistance in meters
BearingBetween(lat1, lon1, lat2, lon2)coordsDoubleBearing in degrees

Contacts

Access macOS Contacts.

MethodParametersReturnsDescription
Search(query)search textArraySearch contacts by name
SearchByEmail(email)emailArrayFind by email
SearchByPhone(phone)phoneArrayFind by phone
All()ArrayGet all contacts
Count()IntegerTotal number of contacts
Create(firstName, lastName)first, lastContactCreate a new contact
Groups()ArrayList contact groups
VCard(contact)contactStringExport as vCard

Color

Color creation and manipulation.

Preset Colors

Color.Red, Color.Green, Color.Blue, Color.White, Color.Black, Color.Yellow, Color.Orange, Color.Purple, Color.Cyan, Color.Magenta, Color.Gray, Color.Pink, Color.Brown, Color.Gold, Color.Silver, Color.Navy, Color.Teal, Color.Coral

Methods

MethodParametersReturnsDescription
RGB(r, g, b)0–255 eachColorCreate from RGB
RGBA(r, g, b, a)0–255, alpha 0–1ColorCreate from RGBA
Hex(hex)hex stringColorCreate from hex (e.g. "#FF0000")
HSL(h, s, l)hue, saturation, lightnessColorCreate from HSL
Mix(c1, c2)color, colorColorMix two colors
Lighten(color, amount)color, 0–1ColorLighten a color
Darken(color, amount)color, 0–1ColorDarken a color

Shell

Execute system commands.

MethodParametersReturnsDescription
Execute(command)command stringObjectRun shell command; returns {Output, ErrorOutput, ExitCode}