1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-22 05:03:22 +00:00

Add documentation on full list of 5.2/5.3 features (#1071)

This commit is contained in:
JackMacWindows 2022-05-01 03:29:43 -04:00 committed by GitHub
parent 49601f0b7c
commit 6239dbe9ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 104 additions and 11 deletions

View File

@ -15,13 +15,11 @@ ## Mouse buttons
Several mouse events (@{mouse_click}, @{mouse_up}, @{mouse_scroll}) contain a "mouse button" code. This takes a
numerical value depending on which button on your mouse was last pressed when this event occurred.
<table class="pretty-table">
<!-- Our markdown parser doesn't work on tables!? Guess I'll have to roll my own soonish :/. -->
<tr><th>Button code</th><th>Mouse button</th></tr>
<tr><td align="right">1</td><td>Left button</td></tr>
<tr><td align="right">2</td><td>Right button</td></tr>
<tr><td align="right">3</td><td>Middle button</td></tr>
</table>
| Button Code | Mouse Button |
|------------:|---------------|
| 1 | Left button |
| 2 | Right button |
| 3 | Middle button |
## Example
Print the button and the coordinates whenever the mouse is clicked.

View File

@ -0,0 +1,95 @@
---
module: [kind=guide] feature_compat
---
# Lua 5.2/5.3 features in CC: Tweaked
CC: Tweaked is based off of the Cobalt Lua runtime, which uses Lua 5.1. However, Cobalt and CC:T implement additional features from Lua 5.2 and 5.3 (as well as some deprecated 5.0 features) that are not available in base 5.1. This page lists all of the compatibility for these newer versions.
## Lua 5.2
| Feature | Supported? | Notes |
|---------------------------------------------------------------|------------|-------------------------------------------------------------------|
| `goto`/labels | ❌ | |
| `_ENV` | 🔶 | The `_ENV` global points to `getfenv()`, but it cannot be set. |
| `\z` escape | ✔ | |
| `\xNN` escape | ✔ | |
| Hex literal fractional/exponent parts | ✔ | |
| Empty statements | ❌ | |
| `__len` metamethod | ✔ | |
| `__ipairs` metamethod | ❌ | |
| `__pairs` metamethod | ✔ | |
| `bit32` library | ✔ | |
| `collectgarbage` isrunning, generational, incremental options | ❌ | `collectgarbage` does not exist in CC:T. |
| New `load` syntax | ✔ | |
| `loadfile` mode parameter | ✔ | Supports both 5.1 and 5.2+ syntax. |
| Removed `loadstring` | 🔶 | Only if `disable_lua51_features` is enabled in the configuration. |
| Removed `getfenv`, `setfenv` | 🔶 | Only if `disable_lua51_features` is enabled in the configuration. |
| `rawlen` function | ✔ | |
| Negative index to `select` | ✔ | |
| Removed `unpack` | 🔶 | Only if `disable_lua51_features` is enabled in the configuration. |
| Arguments to `xpcall` | ❌ | |
| Second return value from `coroutine.running` | ❌ | |
| Removed `module` | ✔ | |
| `package.loaders` -> `package.searchers` | ❌ | |
| Second argument to loader functions | ✔ | |
| `package.config` | ✔ | |
| `package.searchpath` | ✔ | |
| Removed `package.seeall` | ✔ | |
| `string.dump` on functions with upvalues (blanks them out) | ✔ | |
| `string.rep` separator | ❌ | |
| `%g` match group | ❌ | |
| Removal of `%z` match group | ❌ | |
| Removed `table.maxn` | 🔶 | Only if `disable_lua51_features` is enabled in the configuration. |
| `table.pack`/`table.unpack` | ✔ | |
| `math.log` base argument | ✔ | |
| Removed `math.log10` | 🔶 | Only if `disable_lua51_features` is enabled in the configuration. |
| `*L` mode to `file:read` | ✔ | |
| `os.execute` exit type + return value | ❌ | `os.execute` does not exist in CC:T. |
| `os.exit` close argument | ❌ | `os.exit` does not exist in CC:T. |
| `istailcall` field in `debug.getinfo` | ❌ | |
| `nparams` field in `debug.getinfo` | ✔ | |
| `isvararg` field in `debug.getinfo` | ✔ | |
| `debug.getlocal` negative indices for varargs | ❌ | |
| `debug.getuservalue`/`debug.setuservalue` | ❌ | Userdata are rarely used in CC:T, so this is not necessary. |
| `debug.upvalueid` | ✔ | |
| `debug.upvaluejoin` | ✔ | |
| Tail call hooks | ❌ | |
| `=` prefix for chunks | ✔ | |
| Yield across C boundary | ✔ | |
| Removal of ambiguity error | ❌ | |
| Identifiers may no longer use locale-dependent letters | ✔ | |
| Ephemeron tables | ❌ | |
| Identical functions may be reused | ❌ | |
| Generational garbage collector | ❌ | Cobalt uses the built-in Java garbage collector. |
## Lua 5.3
| Feature | Supported? | Notes |
|---------------------------------------------------------------------------------------|------------|---------------------------|
| Integer subtype | ❌ | |
| Bitwise operators/floor division | ❌ | |
| `\u{XXX}` escape sequence | ✔ | |
| `utf8` library | ✔ | |
| removed `__ipairs` metamethod | ✔ | |
| `coroutine.isyieldable` | ❌ | |
| `string.dump` strip argument | ✔ | |
| `string.pack`/`string.unpack`/`string.packsize` | ✔ | |
| `table.move` | ❌ | |
| `math.atan2` -> `math.atan` | ❌ | |
| Removed `math.frexp`, `math.ldexp`, `math.pow`, `math.cosh`, `math.sinh`, `math.tanh` | ❌ | |
| `math.maxinteger`/`math.mininteger` | ❌ | |
| `math.tointeger` | ❌ | |
| `math.type` | ❌ | |
| `math.ult` | ❌ | |
| Removed `bit32` library | ❌ | |
| Remove `*` from `file:read` modes | ✔ | |
| Metamethods respected in `table.*`, `ipairs` | 🔶 | Only `__lt` is respected. |
## Lua 5.0
| Feature | Supported? | Notes |
|----------------------------------|------------|--------------------------------------------------|
| `arg` table | 🔶 | Only set in the shell - not used in functions. |
| `string.gfind` | ✔ | Equal to `string.gmatch`. |
| `table.getn` | ✔ | Equal to `#tbl`. |
| `table.setn` | ❌ | |
| `math.mod` | ✔ | Equal to `math.fmod`. |
| `table.foreach`/`table.foreachi` | ✔ | |
| `gcinfo` | ❌ | Cobalt uses the built-in Java garbage collector. |

View File

@ -16,7 +16,7 @@ terminal supports color by using the function @{term.isColor}.
Grayscale colors are calculated by taking the average of the three components,
i.e. `(red + green + blue) / 3`.
<table class="pretty-table">
<table>
<thead>
<tr><th colspan="8" align="center">Default Colors</th></tr>
<tr>

View File

@ -7,17 +7,17 @@
}
/* Pretty tables, mostly inherited from table.definition-list */
table.pretty-table {
table {
border-collapse: collapse;
width: 100%;
}
table.pretty-table td, table.pretty-table th {
table td, table th {
border: 1px solid #cccccc;
padding: 2px 4px;
}
table.pretty-table th {
table th {
background-color: var(--background-2);
}