docs: add Networking section + process/OS builtins (net_send, owner, is_server, serialize/apply, arg, exit, run, getenv, read_char, file_*)
All checks were successful
docs / build-and-deploy (push) Successful in 1s

Sourced from the compiler's confirmed builtin set and NETWORKING-DESIGN.md, so
the reference reflects the current language surface. 93 -> 104 symbols.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-08-29 16:39:29 +03:00
parent ccef707e4c
commit 25f987e30d
17 changed files with 144 additions and 5 deletions

View file

@ -1,7 +1,7 @@
---
id: builtins
title: Builtin functions
order: 12
order: 13
---
Global functions available anywhere, beyond the namespaced APIs above.

View file

@ -0,0 +1,12 @@
---
id: fn-arg
name: arg_count / arg
category: builtins
kind: builtin
tokens: arg_count arg
sig: arg_count() -> int arg(i) -> str
tip: The command line; argv[0] is included.
order: 20
---
Read the process command line: <code>arg_count()</code> is the number of arguments (including the program name at index 0) and <code>arg(i)</code> returns the <code>i</code>th as a string.

View file

@ -0,0 +1,12 @@
---
id: fn-exit
name: exit
category: builtins
kind: builtin
tokens: exit
sig: exit(code)
tip: Exit the process immediately with a status code.
order: 21
---
Terminate the process now with the given status code. Unlike <code>quit()</code>, which ends the game loop cleanly after the current frame, <code>exit</code> stops the program at once.

View file

@ -0,0 +1,12 @@
---
id: fn-file
name: file_write / file_stdout / file_stderr
category: builtins
kind: builtin
tokens: file_write file_stdout file_stderr
sig: file_stdout() -> ptr file_stderr() -> ptr file_write(handle, buf, len)
tip: Low-level output handles and raw writing.
order: 25
---
<code>file_stdout()</code> and <code>file_stderr()</code> return the standard stream handles; <code>file_write(handle, buf, len)</code> writes <code>len</code> raw bytes to one. Most code uses <code>print</code> instead — these are the primitive underneath.

View file

@ -0,0 +1,12 @@
---
id: fn-getenv
name: getenv
category: builtins
kind: builtin
tokens: getenv
sig: getenv(name) -> str
tip: Read an environment variable.
order: 23
---
Return the value of environment variable <code>name</code> (empty when it is unset).

View file

@ -0,0 +1,12 @@
---
id: fn-read_char
name: read_char
category: builtins
kind: builtin
tokens: read_char
sig: read_char() -> int
tip: Read one byte from standard input (-1 at end of input).
order: 24
---
Read a single byte from standard input, returning its value or <code>-1</code> at end of input — the basis for headless, pipe-driven runs.

View file

@ -0,0 +1,12 @@
---
id: fn-run
name: run
category: builtins
kind: builtin
tokens: run
sig: run(cmd)
tip: Run a shell command.
order: 22
---
Run <code>cmd</code> as a shell command — handy for build steps and tooling written in Ludic.