mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 04:00:30 +00:00
Some minor documentation improvements
- Start making the summary lines for modules a little better. Just say what the module does, rather than "The X API does Y" or "Provides Y". There's still a lot of work to be done here. - Bundle prism.js on the page, so we can highlight non-Lua code. - Copy our local_ips wiki page to the main docs.
This commit is contained in:
parent
9cb7091ce7
commit
cbbab26bf3
95
doc/guides/local_ips.md
Normal file
95
doc/guides/local_ips.md
Normal file
@ -0,0 +1,95 @@
|
||||
---
|
||||
module: [kind=guide] local_ips
|
||||
---
|
||||
|
||||
# Allowing access to local IPS
|
||||
By default, ComputerCraft blocks access to local IP addresses for security. This means you can't normally access any
|
||||
HTTP server running on your computer. However, this may be useful for testing programs without having a remote
|
||||
server. You can unblock these IPs in the ComputerCraft config.
|
||||
|
||||
## Minecraft 1.13 and later, CC:T 1.87.0 and later {#cc-1.87.0}
|
||||
The configuration file can be located at `serverconfig/computercraft-server.toml` inside the world folder on either
|
||||
single-player or multiplayer. Look for lines that look like this:
|
||||
|
||||
```toml
|
||||
#A list of rules which control behaviour of the "http" API for specific domains or IPs.
|
||||
#Each rule is an item with a 'host' to match against, and a series of properties. The host may be a domain name ("pastebin.com"),
|
||||
#wildcard ("*.pastebin.com") or CIDR notation ("127.0.0.0/8"). If no rules, the domain is blocked.
|
||||
[[http.rules]]
|
||||
host = "$private"
|
||||
action = "deny"
|
||||
```
|
||||
|
||||
On 1.95.0 and later, this will be a single entry with `host = "$private"`. On earlier versions, this will be a number of
|
||||
`[[http.rules]]` with various IP addresses. You will want to remove all of the `[[http.rules]]` entires that have
|
||||
`action = "deny"`. Then save the file and relaunch Minecraft (Server).
|
||||
|
||||
Here's what it should look like after removing:
|
||||
|
||||
```toml
|
||||
#A list of rules which control behaviour of the "http" API for specific domains or IPs.
|
||||
#Each rule is an item with a 'host' to match against, and a series of properties. The host may be a domain name ("pastebin.com"),
|
||||
#wildcard ("*.pastebin.com") or CIDR notation ("127.0.0.0/8"). If no rules, the domain is blocked.
|
||||
[[http.rules]]
|
||||
#The maximum size (in bytes) that a computer can send or receive in one websocket packet.
|
||||
max_websocket_message = 131072
|
||||
host = "*"
|
||||
#The maximum size (in bytes) that a computer can upload in a single request. This includes headers and POST text.
|
||||
max_upload = 4194304
|
||||
action = "allow"
|
||||
#The maximum size (in bytes) that a computer can download in a single request. Note that responses may receive more data than allowed, but this data will not be returned to the client.
|
||||
max_download = 16777216
|
||||
#The period of time (in milliseconds) to wait before a HTTP request times out. Set to 0 for unlimited.
|
||||
timeout = 30000
|
||||
```
|
||||
|
||||
## Minecraft 1.13 and later, CC:T 1.86.2 and earlier {#cc-1.86.2}
|
||||
The configuration file for singleplayer is at `.minecraft/config/computercraft-common.toml`. Look for lines that look
|
||||
like this:
|
||||
|
||||
```toml
|
||||
#A list of wildcards for domains or IP ranges that cannot be accessed through the "http" API on Computers.
|
||||
#If this is empty then all whitelisted domains will be accessible. Example: "*.github.com" will block access to all subdomains of github.com.
|
||||
#You can use domain names ("pastebin.com"), wilcards ("*.pastebin.com") or CIDR notation ("127.0.0.0/8").
|
||||
blacklist = ["127.0.0.0/8", "10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "fd00::/8"]
|
||||
```
|
||||
|
||||
Remove everything inside the array, leaving the last line as `blacklist = []`. Then save the file and relaunch Minecraft.
|
||||
|
||||
Here's what it should look like after removing:
|
||||
|
||||
```toml
|
||||
#A list of wildcards for domains or IP ranges that cannot be accessed through the "http" API on Computers.
|
||||
#If this is empty then all whitelisted domains will be accessible. Example: "*.github.com" will block access to all subdomains of github.com.
|
||||
#You can use domain names ("pastebin.com"), wilcards ("*.pastebin.com") or CIDR notation ("127.0.0.0/8").
|
||||
blacklist = []
|
||||
```
|
||||
|
||||
## Minecraft 1.12.2 and earlier {#mc-1.12}
|
||||
On singleplayer, the configuration file is located at `.minecraft\config\ComputerCraft.cfg`. On multiplayer, the
|
||||
configuration file is located at `<server folder>\config\ComputerCraft.cfg`. Look for lines that look like this:
|
||||
|
||||
```ini
|
||||
# A list of wildcards for domains or IP ranges that cannot be accessed through the "http" API on Computers.
|
||||
# If this is empty then all explicitly allowed domains will be accessible. Example: "*.github.com" will block access to all subdomains of github.com.
|
||||
# You can use domain names ("pastebin.com"), wildcards ("*.pastebin.com") or CIDR notation ("127.0.0.0/8").
|
||||
S:blocked_domains <
|
||||
127.0.0.0/8
|
||||
10.0.0.0/8
|
||||
172.16.0.0/12
|
||||
192.168.0.0/16
|
||||
fd00::/8
|
||||
>
|
||||
```
|
||||
|
||||
Delete everything between the `<>`, leaving the last line as `S:blocked_domains = <>`. Then save the file and relaunch
|
||||
Minecraft (Server).
|
||||
|
||||
Here's what it should look like after removing:
|
||||
|
||||
```ini
|
||||
# A list of wildcards for domains or IP ranges that cannot be accessed through the "http" API on Computers.
|
||||
# If this is empty then all explicitly allowed domains will be accessible. Example: "*.github.com" will block access to all subdomains of github.com.
|
||||
# You can use domain names ("pastebin.com"), wildcards ("*.pastebin.com") or CIDR notation ("127.0.0.0/8").
|
||||
S:blocked_domains <>
|
||||
```
|
@ -1,6 +1,4 @@
|
||||
--- The FS API allows you to manipulate files and the filesystem.
|
||||
--
|
||||
-- @module fs
|
||||
--- @module fs
|
||||
|
||||
--- Returns true if a path is mounted to the parent filesystem.
|
||||
--
|
||||
|
@ -62,7 +62,7 @@ function print(...) end
|
||||
-- @usage printError("Something went wrong!")
|
||||
function printError(...) end
|
||||
|
||||
--[[- Reads user input from the terminal, automatically handling arrow keys,
|
||||
--[[- Reads user input from the terminal. This automatically handles arrow keys,
|
||||
pasting, character replacement, history scrollback, auto-completion, and
|
||||
default values.
|
||||
|
||||
@ -110,10 +110,15 @@ the prompt.
|
||||
]]
|
||||
function read(replaceChar, history, completeFn, default) end
|
||||
|
||||
--- The ComputerCraft and Minecraft version of the current computer environment.
|
||||
--- Stores the current ComputerCraft and Minecraft versions.
|
||||
--
|
||||
-- Outside of Minecraft (for instance, in an emulator) @{_HOST} will contain the
|
||||
-- emulator's version instead.
|
||||
--
|
||||
-- For example, `ComputerCraft 1.93.0 (Minecraft 1.15.2)`.
|
||||
-- @usage _HOST
|
||||
-- @usage Print the current computer's environment.
|
||||
--
|
||||
-- print(_HOST)
|
||||
-- @since 1.76
|
||||
_HOST = _HOST
|
||||
|
||||
|
@ -1,14 +1,13 @@
|
||||
--- The http library allows communicating with web servers, sending and
|
||||
-- receiving data from them.
|
||||
--- Make HTTP requests, sending and receiving data to a remote web server.
|
||||
--
|
||||
-- @module http
|
||||
-- @since 1.1
|
||||
-- @see local_ips To allow accessing servers running on your local network.
|
||||
|
||||
--- Asynchronously make a HTTP request to the given url.
|
||||
--
|
||||
-- This returns immediately, a [`http_success`](#http-success-event) or
|
||||
-- [`http_failure`](#http-failure-event) will be queued once the request has
|
||||
-- completed.
|
||||
-- This returns immediately, a @{http_success} or @{http_failure} will be queued
|
||||
-- once the request has completed.
|
||||
--
|
||||
-- @tparam string url The url to request
|
||||
-- @tparam[opt] string body An optional string containing the body of the
|
||||
@ -112,9 +111,8 @@ function post(...) end
|
||||
|
||||
--- Asynchronously determine whether a URL can be requested.
|
||||
--
|
||||
-- If this returns `true`, one should also listen for [`http_check`
|
||||
-- events](#http-check-event) which will container further information about
|
||||
-- whether the URL is allowed or not.
|
||||
-- If this returns `true`, one should also listen for @{http_check} which will
|
||||
-- container further information about whether the URL is allowed or not.
|
||||
--
|
||||
-- @tparam string url The URL to check.
|
||||
-- @treturn true When this url is not invalid. This does not imply that it is
|
||||
@ -128,9 +126,8 @@ function checkURLAsync(url) end
|
||||
|
||||
--- Determine whether a URL can be requested.
|
||||
--
|
||||
-- If this returns `true`, one should also listen for [`http_check`
|
||||
-- events](#http-check-event) which will container further information about
|
||||
-- whether the URL is allowed or not.
|
||||
-- If this returns `true`, one should also listen for @{http_check} which will
|
||||
-- container further information about whether the URL is allowed or not.
|
||||
--
|
||||
-- @tparam string url The URL to check.
|
||||
-- @treturn true When this url is valid and can be requested via @{http.request}.
|
||||
@ -168,9 +165,8 @@ function websocket(url, headers) end
|
||||
|
||||
--- Asynchronously open a websocket.
|
||||
--
|
||||
-- This returns immediately, a [`websocket_success`](#websocket-success-event)
|
||||
-- or [`websocket_failure`](#websocket-failure-event) will be queued once the
|
||||
-- request has completed.
|
||||
-- This returns immediately, a @{websocket_success} or @{websocket_failure}
|
||||
-- will be queued once the request has completed.
|
||||
--
|
||||
-- @tparam string url The websocket url to connect to. This should have the
|
||||
-- `ws://` or `wss://` protocol.
|
||||
|
@ -30,8 +30,8 @@ import java.util.OptionalLong;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* The FS API provides access to the computer's files and filesystem, allowing you to manipulate files, directories and
|
||||
* paths. This includes:
|
||||
* Interact with the computer's files and filesystem, allowing you to manipulate files, directories and paths. This
|
||||
* includes:
|
||||
*
|
||||
* <ul>
|
||||
* <li>**Reading and writing files:** Call {@link #open} to obtain a file "handle", which can be used to read from or
|
||||
|
@ -28,7 +28,7 @@ import java.util.Optional;
|
||||
import static dan200.computercraft.core.apis.TableHelper.*;
|
||||
|
||||
/**
|
||||
* The http library allows communicating with web servers, sending and receiving data from them.
|
||||
* Placeholder description, please ignore.
|
||||
*
|
||||
* @cc.module http
|
||||
* @hidden
|
||||
|
@ -11,7 +11,7 @@ import dan200.computercraft.api.lua.LuaFunction;
|
||||
import dan200.computercraft.core.computer.ComputerSide;
|
||||
|
||||
/**
|
||||
* Interact with redstone attached to this computer.
|
||||
* Get and set redstone signals adjacent to this computer.
|
||||
*
|
||||
* The {@link RedstoneAPI} library exposes three "types" of redstone control:
|
||||
* - Binary input/output ({@link #setOutput}/{@link #getInput}): These simply check if a redstone wire has any input or
|
||||
|
@ -16,7 +16,8 @@ import dan200.computercraft.shared.util.Colour;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* The Terminal API provides functions for writing text to the terminal and monitors, and drawing ASCII graphics.
|
||||
* Interact with a computer's terminal or monitors, writing text and drawing
|
||||
* ASCII graphics.
|
||||
*
|
||||
* @cc.module term
|
||||
*/
|
||||
|
@ -1,12 +1,13 @@
|
||||
--[[- The Colors API allows you to manipulate sets of colors.
|
||||
--[[- Constants and functions for colour values, suitable for working with
|
||||
@{term} and @{redstone}.
|
||||
|
||||
This is useful in conjunction with Bundled Cables from the RedPower mod, RedNet
|
||||
Cables from the MineFactory Reloaded mod, and colors on Advanced Computers and
|
||||
Advanced Monitors.
|
||||
This is useful in conjunction with @{redstone.setBundledOutput|Bundled Cables}
|
||||
from mods like Project Red, and @{term.setTextColour|colors on Advanced
|
||||
Computers and Advanced Monitors}.
|
||||
|
||||
For the non-American English version just replace @{colors} with @{colours} and
|
||||
it will use the other API, colours which is exactly the same, except in British
|
||||
English (e.g. @{colors.gray} is spelt @{colours.grey}).
|
||||
For the non-American English version just replace @{colors} with @{colours}.
|
||||
This alternative API is exactly the same, except the colours use British English
|
||||
(e.g. @{colors.gray} is spelt @{colours.grey}).
|
||||
|
||||
On basic terminals (such as the Computer and Monitor), all the colors are
|
||||
converted to grayscale. This means you can still use all 16 colors on the
|
||||
|
@ -1,4 +1,4 @@
|
||||
--- Colours for lovers of British spelling.
|
||||
--- An alternative version of @{colors} for lovers of British spelling.
|
||||
--
|
||||
-- @see colors
|
||||
-- @module colours
|
||||
|
@ -1,21 +1,26 @@
|
||||
--- The commands API allows your system to directly execute [Minecraft
|
||||
-- commands][mc] and gather data from the results.
|
||||
--
|
||||
-- While one may use @{commands.exec} directly to execute a command, the
|
||||
-- commands API also provides helper methods to execute every command. For
|
||||
-- instance, `commands.say("Hi!")` is equivalent to `commands.exec("say Hi!")`.
|
||||
--
|
||||
-- @{commands.async} provides a similar interface to execute asynchronous
|
||||
-- commands. `commands.async.say("Hi!")` is equivalent to
|
||||
-- `commands.execAsync("Hi!")`.
|
||||
--
|
||||
-- [mc]: https://minecraft.gamepedia.com/Commands
|
||||
--
|
||||
-- @module commands
|
||||
-- @usage Set the block above this computer to stone:
|
||||
--
|
||||
-- commands.setblock("~", "~1", "~", "minecraft:stone")
|
||||
--[[- Execute [Minecraft commands][mc] and gather data from the results from
|
||||
a command computer.
|
||||
|
||||
:::note
|
||||
This API is only available on Command computers. It is not accessible to normal
|
||||
players.
|
||||
:::
|
||||
|
||||
While one may use @{commands.exec} directly to execute a command, the
|
||||
commands API also provides helper methods to execute every command. For
|
||||
instance, `commands.say("Hi!")` is equivalent to `commands.exec("say Hi!")`.
|
||||
|
||||
@{commands.async} provides a similar interface to execute asynchronous
|
||||
commands. `commands.async.say("Hi!")` is equivalent to
|
||||
`commands.execAsync("Hi!")`.
|
||||
|
||||
[mc]: https://minecraft.gamepedia.com/Commands
|
||||
|
||||
@module commands
|
||||
@usage Set the block above this computer to stone:
|
||||
|
||||
commands.setblock("~", "~1", "~", "minecraft:stone")
|
||||
]]
|
||||
if not commands then
|
||||
error("Cannot load command API on normal computer", 2)
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
--[[- The Disk API allows you to interact with disk drives.
|
||||
--[[- Interact with disk drives.
|
||||
|
||||
These functions can operate on locally attached or remote disk drives. To use a
|
||||
locally attached drive, specify “side” as one of the six sides (e.g. `left`); to
|
||||
|
@ -1,5 +1,5 @@
|
||||
--[[- The GPS API provides a method for turtles and computers to retrieve their
|
||||
own locations.
|
||||
--[[- Use @{modem|modems} to locate the position of the current turtle or
|
||||
computers.
|
||||
|
||||
It broadcasts a PING message over @{rednet} and wait for responses. In order for
|
||||
this system to work, there must be at least 4 computers used as gps hosts which
|
||||
|
@ -1,4 +1,4 @@
|
||||
--- Provides an API to read help files.
|
||||
--- Find help files on the current computer.
|
||||
--
|
||||
-- @module help
|
||||
-- @since 1.2
|
||||
|
@ -1,5 +1,4 @@
|
||||
--- The Keys API provides a table of numerical codes corresponding to keyboard
|
||||
-- keys, suitable for decoding key events.
|
||||
--- Constants for all keyboard "key codes", as queued by the @{key} event.
|
||||
--
|
||||
-- These values are not guaranteed to remain the same between versions. It is
|
||||
-- recommended that you use the constants provided by this file, rather than
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- An API for advanced systems which can draw pixels and lines, load and draw
|
||||
-- image files. You can use the `colors` API for easier color manipulation.
|
||||
--- Utilities for drawing more complex graphics, such as pixels, lines and
|
||||
-- images.
|
||||
--
|
||||
-- @module paintutils
|
||||
-- @since 1.45
|
||||
|
@ -1,8 +1,8 @@
|
||||
--[[- Provides a simple implementation of multitasking.
|
||||
--[[- A simple way to run several functions at once.
|
||||
|
||||
Functions are not actually executed simultaniously, but rather this API will
|
||||
automatically switch between them whenever they yield (eg whenever they call
|
||||
@{coroutine.yield}, or functions that call that - eg @{os.pullEvent} - or
|
||||
automatically switch between them whenever they yield (e.g. whenever they call
|
||||
@{coroutine.yield}, or functions that call that - such as @{os.pullEvent} - or
|
||||
functions that call that, etc - basically, anything that causes the function
|
||||
to "pause").
|
||||
|
||||
@ -12,6 +12,27 @@ script to pause - eg @{os.sleep}, @{rednet.receive}, most of the @{turtle} API,
|
||||
etc) can safely be used in one without affecting the event queue accessed by
|
||||
the other.
|
||||
|
||||
|
||||
:::caution
|
||||
When using this API, be careful to pass the functions you want to run in
|
||||
parallel, and _not_ the result of calling those functions.
|
||||
|
||||
For instance, the following is correct:
|
||||
|
||||
```lua
|
||||
local function do_sleep() sleep(1) end
|
||||
parallel.waitForAny(do_sleep, rednet.receive)
|
||||
```
|
||||
|
||||
but the following is **NOT**:
|
||||
|
||||
```lua
|
||||
local function do_sleep() sleep(1) end
|
||||
parallel.waitForAny(do_sleep(), rednet.receive)
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
@module parallel
|
||||
@since 1.2
|
||||
]]
|
||||
|
@ -1,4 +1,6 @@
|
||||
--[[- Peripherals are blocks (or turtle and pocket computer upgrades) which can
|
||||
--[[- Find and control peripherals attached to this computer.
|
||||
|
||||
Peripherals are blocks (or turtle and pocket computer upgrades) which can
|
||||
be controlled by a computer. For instance, the @{speaker} peripheral allows a
|
||||
computer to play music and the @{monitor} peripheral allows you to display text
|
||||
in the world.
|
||||
|
@ -1,6 +1,6 @@
|
||||
--[[- The Rednet API allows computers to communicate between each other by using
|
||||
@{modem|modems}. It provides a layer of abstraction on top of the main @{modem}
|
||||
peripheral, making it slightly easier to use.
|
||||
--[[- Communicate with other computers by using @{modem|modems}. @{rednet}
|
||||
provides a layer of abstraction on top of the main @{modem} peripheral, making
|
||||
it slightly easier to use.
|
||||
|
||||
## Basic usage
|
||||
In order to send a message between two computers, each computer must have a
|
||||
|
@ -1,5 +1,4 @@
|
||||
--- The settings API allows to store values and save them to a file for
|
||||
-- persistent configurations for CraftOS and your programs.
|
||||
--- Read and write configuration options for CraftOS and your programs.
|
||||
--
|
||||
-- By default, the settings API will load its configuration from the
|
||||
-- `/.settings` file. One can then use @{settings.save} to update the file.
|
||||
|
@ -1,7 +1,4 @@
|
||||
--- The Terminal API provides functions for writing text to the terminal and
|
||||
-- monitors, and drawing ASCII graphics.
|
||||
--
|
||||
-- @module term
|
||||
--- @module term
|
||||
|
||||
local expect = dofile("rom/modules/main/cc/expect.lua").expect
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
--- The @{textutils} API provides helpful utilities for formatting and
|
||||
-- manipulating strings.
|
||||
--- Helpful utilities for formatting and manipulating strings.
|
||||
--
|
||||
-- @module textutils
|
||||
-- @since 1.2
|
||||
|
@ -1,4 +1,6 @@
|
||||
--- The vector API provides methods to create and manipulate vectors.
|
||||
--- A basic 3D vector type and some common vector operations. This may be useful
|
||||
-- when working with coordinates in Minecraft's world (such as those from the
|
||||
-- @{gps} API).
|
||||
--
|
||||
-- An introduction to vectors can be found on [Wikipedia][wiki].
|
||||
--
|
||||
|
@ -1,32 +1,33 @@
|
||||
--- The Window API allows easy definition of spaces within the display that can
|
||||
-- be written/drawn to, then later redrawn/repositioned/etc as need be. The API
|
||||
-- itself contains only one function, @{window.create}, which returns the
|
||||
-- windows themselves.
|
||||
--
|
||||
-- Windows are considered terminal objects - as such, they have access to nearly
|
||||
-- all the commands in the term API (plus a few extras of their own, listed
|
||||
-- within said API) and are valid targets to redirect to.
|
||||
--
|
||||
-- Each window has a "parent" terminal object, which can be the computer's own
|
||||
-- display, a monitor, another window or even other, user-defined terminal
|
||||
-- objects. Whenever a window is rendered to, the actual screen-writing is
|
||||
-- performed via that parent (or, if that has one too, then that parent, and so
|
||||
-- forth). Bear in mind that the cursor of a window's parent will hence be moved
|
||||
-- around etc when writing a given child window.
|
||||
--
|
||||
-- Windows retain a memory of everything rendered "through" them (hence acting
|
||||
-- as display buffers), and if the parent's display is wiped, the window's
|
||||
-- content can be easily redrawn later. A window may also be flagged as
|
||||
-- invisible, preventing any changes to it from being rendered until it's
|
||||
-- flagged as visible once more.
|
||||
--
|
||||
-- A parent terminal object may have multiple children assigned to it, and
|
||||
-- windows may overlap. For example, the Multishell system functions by
|
||||
-- assigning each tab a window covering the screen, each using the starting
|
||||
-- terminal display as its parent, and only one of which is visible at a time.
|
||||
--
|
||||
-- @module window
|
||||
-- @since 1.6
|
||||
--[[- A @{term.Redirect|terminal redirect} occupying a smaller area of an
|
||||
existing terminal. This allows for easy definition of spaces within the display
|
||||
that can be written/drawn to, then later redrawn/repositioned/etc as need
|
||||
be. The API itself contains only one function, @{window.create}, which returns
|
||||
the windows themselves.
|
||||
|
||||
Windows are considered terminal objects - as such, they have access to nearly
|
||||
all the commands in the term API (plus a few extras of their own, listed within
|
||||
said API) and are valid targets to redirect to.
|
||||
|
||||
Each window has a "parent" terminal object, which can be the computer's own
|
||||
display, a monitor, another window or even other, user-defined terminal
|
||||
objects. Whenever a window is rendered to, the actual screen-writing is
|
||||
performed via that parent (or, if that has one too, then that parent, and so
|
||||
forth). Bear in mind that the cursor of a window's parent will hence be moved
|
||||
around etc when writing a given child window.
|
||||
|
||||
Windows retain a memory of everything rendered "through" them (hence acting as
|
||||
display buffers), and if the parent's display is wiped, the window's content can
|
||||
be easily redrawn later. A window may also be flagged as invisible, preventing
|
||||
any changes to it from being rendered until it's flagged as visible once more.
|
||||
|
||||
A parent terminal object may have multiple children assigned to it, and windows
|
||||
may overlap. For example, the Multishell system functions by assigning each tab
|
||||
a window covering the screen, each using the starting terminal display as its
|
||||
parent, and only one of which is visible at a time.
|
||||
|
||||
@module window
|
||||
@since 1.6
|
||||
]]
|
||||
|
||||
local expect = dofile("rom/modules/main/cc/expect.lua").expect
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
--[[-
|
||||
Provides utilities for converting between streams of DFPWM audio data and a list of amplitudes.
|
||||
Convert between streams of DFPWM audio data and a list of amplitudes.
|
||||
|
||||
DFPWM (Dynamic Filter Pulse Width Modulation) is an audio codec designed by GreaseMonkey. It's a relatively compact
|
||||
format compared to raw PCM data, only using 1 bit per sample, but is simple enough to simple enough to encode and decode
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- Provides utilities for working with "nft" images.
|
||||
--- Read and draw nbt ("Nitrogen Fingers Text") images.
|
||||
--
|
||||
-- nft ("Nitrogen Fingers Text") is a file format for drawing basic images.
|
||||
-- Unlike the images that @{paintutils.parseImage} uses, nft supports coloured
|
||||
-- text.
|
||||
-- text as well as simple coloured pixels.
|
||||
--
|
||||
-- @module cc.image.nft
|
||||
-- @since 1.90.0
|
||||
|
@ -1,5 +1,5 @@
|
||||
--[[- Provides a "pretty printer", for rendering data structures in an
|
||||
aesthetically pleasing manner.
|
||||
--[[- A pretty printer for rendering data structures in an aesthetically
|
||||
pleasing manner.
|
||||
|
||||
In order to display something using @{cc.pretty}, you build up a series of
|
||||
@{Doc|documents}. These behave a little bit like strings; you can concatenate
|
||||
|
@ -1,5 +1,5 @@
|
||||
--[[- This provides a pure Lua implementation of the builtin @{require} function
|
||||
and @{package} library.
|
||||
--[[- A pure Lua implementation of the builtin @{require} function and
|
||||
@{package} library.
|
||||
|
||||
Generally you do not need to use this module - it is injected into the every
|
||||
program's environment. However, it may be useful when building a custom shell or
|
||||
|
@ -9,6 +9,8 @@ import exampleNft from "./mount/example.nft";
|
||||
import exampleAudioLicense from "./mount/example.dfpwm.LICENSE";
|
||||
import exampleAudioUrl from "./mount/example.dfpwm";
|
||||
|
||||
import "./prism.js";
|
||||
|
||||
const defaultFiles: { [filename: string]: string } = {
|
||||
".settings": settingsFile,
|
||||
"startup.lua": startupFile,
|
||||
@ -76,7 +78,9 @@ class Window extends Component<WindowProps, WindowState> {
|
||||
const snippet = element.getAttribute("data-snippet");
|
||||
if (snippet) this.snippets[snippet] = example;
|
||||
|
||||
if (element.getAttribute("data-lua-kind") == "expr") {
|
||||
// We attempt to pretty-print the result of a function _except_ when the function
|
||||
// is print. This is pretty ugly, but prevents the confusing trailing "1".
|
||||
if (element.getAttribute("data-lua-kind") == "expr" && !example.startsWith("print(")) {
|
||||
example = exprTemplate.replace("__expr__", example);
|
||||
}
|
||||
|
||||
|
5
src/web/prism.js
Normal file
5
src/web/prism.js
Normal file
File diff suppressed because one or more lines are too long
@ -21,7 +21,7 @@ table th {
|
||||
background-color: var(--background-2);
|
||||
}
|
||||
|
||||
pre.highlight.highlight-lua {
|
||||
pre.highlight {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user