Commit Graph

29 Commits

Author SHA1 Message Date
Jonathan Coates 2a9f35de5e
Backport several ROM/Lua commits
- Fix GPS returning nan on duplicate positions.
 - Distinguish between all parsers passing and failing.
 - Improve several comma related parse errors.
 - Ignore metatables in textutils.serialize.
 - Detect common audio containers in "speaker".

Co-authored-by: Wojbie <Wojbie@gmail.com>
2023-05-03 23:26:44 +01:00
Jonathan Coates 9b3cadf57c
Cherry pick several changes back from 1.19.3
The main purpose of this is to backport the improved parse/runtime
errors to older versions. I think they're sufficiently useful that we
should try to make it as widely available as possible.

We've been running them for a week now on SC3 and the released version
and not seen any issues, so I think it's probably stable enough.

This is a pretty lazy commit: I ended up copying the whole ROM over and
then picking up a few other related changes along the way.

 - Trim spaces from file paths (b8fce1eecc)

 - Correctly format 12AM/PM with
   %I (9f48395596)

 - Fix http.request and htpt.websocketAsync not handling a few failure
   edge-cases correctly (3b42f22a4f).

 - Move the internal modules into the main package path, hidden under
   cc.internal (34a31abd9c).

 - Gather code coverage in Java instead of
   Lua (28a55349a9).

 - Make error messages in edit more
   obvious (8cfbfe7ceb).

 - Make mcfly's test methods global. This means we don't need to pass
   stub everywhere (7335a892b5).

 - Improve runtime and parse errors. This comes from numerous commits,
   but chiefly a12b405acf, and
   5502412181.

 - Hide the internal redirect methods in
   multishell (33b6f38339).

Note this does /not/ include the shebang changes (sorry Emma!). I've
tried to avoid adding any user-controllable features, mostly because I
don't know how to handle the versioning otherwise :).
2023-02-14 09:45:03 +00:00
Jonathan Coates b2d2153258
Add several missing version annotations
I probably need to add this to the pre-release checklist. Don't think
there's a good way to automate this :(
2022-10-29 22:49:45 +01:00
Jonathan Coates 97387556fe
Handle file transfers inside CraftOS (#1190)
- Add a new file_transfer event. This has the signature
   "file_transfer", TransferredFiles.

   TransferredFiles has a single method getFiles(), which returns a list
   of all transferred files.

 - Add a new "import" program which waits for a file_transfer event and
   writes files to the current directory.

 - If a file_transfer event is not handled (i.e. its getFiles() method
   is not called) within 5 seconds on the client, we display a toast
   informing the user on how to upload a file.
2022-10-29 12:01:23 +01:00
Jonathan Coates da5956e943
Make the sidebar a little wider
I was going to do something productive tonight, but then this happened.

Whatever, I'm retired, I'm allowed to make my entire existence just
adding 50px to things. Heck, maybe I'll do the same tomorrow too.
2022-09-29 22:21:38 +01:00
Ivo Leal 9d18487dc5
Fixed usage example of textuils.pagedTabulate 2022-08-28 15:24:47 +01:00
Chick Chicky d9e75d7c47
Added parse_empty_array to textutils.unserialiseJSON (#1092)
Fixes #1089.
2022-05-08 09:53:02 +00:00
JackMacWindows f5f0c7990a
Add note about special JSON values in docs for `textutils.unserializeJSON` (#1058) 2022-05-07 10:10:25 +00:00
Jonathan Coates cbbab26bf3
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.
2022-05-02 17:49:32 +01:00
Jonathan Coates bed2e0b658
Write an introduction to the turtle API
It's better at least, I just don't know if it's good.
2021-12-21 11:53:46 +00:00
Wojbie 94ad106272
Several improvements to textutils.serialise (#920)
- Handle nan and infinity, by emitting them as 0/0 and 0/1.
- Differentiate between repeated and recursive tables in the
  error message.
2021-09-17 10:30:23 +01:00
JackMacWindows 340ade170f
Add the rest of the feature introduction versions to the docs (#908) 2021-08-26 08:02:58 +01:00
Jonathan Coates 0f899357c2
Some documentation bits and bobs
More #853, closes #858
2021-08-25 22:33:55 +01:00
Jonathan Coates 686c6a4c44
Use cc.strings.wrap inside slowWrite
Means we don't end up re-wrapping text and producing incorrect results.
Fixes #865
2021-08-01 08:43:37 +01:00
magiczocker10 38335ca187
Add some options for textutils.serialize (#664) 2021-05-29 17:46:58 +01:00
FensieRenaud 763bab80fa Serialise sparse arrays into JSON (#685) 2021-01-18 20:48:33 +00:00
SquidDev 04f9644ae7 Allow strings or numbers in textutils.*tabulate
A little dubious, but apparently CC used to support it. This means we're
consistent with methods like io.write or string.len which accept strings
or numbers.

Fixes #591
2020-11-27 21:29:11 +00:00
SquidDev 7f90f2f7ca Clean up some examples a little bit
Would be good if they didn't crash and burn on entry :).
2020-11-12 19:40:18 +00:00
SquidDev 666e83cf4f Fix JSON objects failing to pass
Maybe I should run the whole test suite, not just the things I think
matter? Nah....
2020-11-01 11:48:19 +00:00
SquidDev c58441b29c Various SNBT parsing improvements
Correctly handle:
 - Typed arrays ([I; 1, 2, 3])
 - All suffixed numbers (1.2d)
 - Single-quoted strings

Fixes #559
2020-11-01 11:36:48 +00:00
SquidDev 59de21eae2 Handle tabs when parsing JSON
Fixes #539
2020-09-11 18:02:23 +01:00
R93950X d5de39ebd4
Fix time formatting (#527)
Fixes #525.

Co-authored-by: R93950X <R93950X@users.noreply.github.com>
2020-08-22 15:17:12 +01:00
neumond 053cb1b53c Fix JSON serialization of strings
Control characters become escaped as JSON requires
Non-ASCII characters get escaped as well for better interoperability
We assume here that lua strings represent only first 256 code points of unicode
2020-07-25 19:40:06 +03:00
Jonathan Coates 9499654757
Add documentation for peripherals
No clue how we're going to do this for the dynamic peripheral system
if/when that ships, but this is a good first stage.

Like the Java APIs, this relies on stub files, so we can't link to the
implementation which is a bit of a shame. However, it's a good first
step.
2020-06-24 12:12:06 +01:00
SquidDev d847a4d9e0 Merge branch 'master' into mc-1.14.x
This also deletes display list support - MC 1.14 now requires VBOs to be
supported in some capacity.
2020-04-22 09:45:23 +01:00
SquidDev 037cbabb32 Merge branch 'master' into mc-1.14.x
Unfortunately we can't apply the config changes due to backwards
compatibility. This'll be something we may need to PR into Forge.

CraftTweaker support still needs to be added.
2019-12-23 22:34:30 +00:00
SquidDev 4b0e5c445c Merge branch 'master' into mc-1.14.x 2019-08-04 10:57:20 +01:00
SquidDev c82d8a7c2a Merge branch 'master' into mc-1.13.x 2019-06-02 16:46:45 +01:00
SquidDev 5e462adc5c Relocate all resource files
- textures/{block,item}s -> textures/{block,item}
 - assets/*/{advancements,lua,recipes} -> data/*/...
2019-04-02 13:18:43 +01:00