From abba7e05344c01a52b0f8ccec1726099326cb1fb Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Wed, 27 May 2026 12:35:43 +1000 Subject: [PATCH] Updated cheatsheet.md --- docs/src/cheatsheet.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/src/cheatsheet.md b/docs/src/cheatsheet.md index a9a7045..02c412f 100644 --- a/docs/src/cheatsheet.md +++ b/docs/src/cheatsheet.md @@ -141,4 +141,19 @@ TOY_API void Toy_inheritVM(Toy_VM* parentVM, Toy_VM* subVM); TOY_API unsigned int Toy_runVM(Toy_VM* vm); TOY_API void Toy_freeVM(Toy_VM* vm); TOY_API Toy_Value Toy_getReturnValueFromVM(Toy_VM* parentVM, Toy_VM* subVM); -``` \ No newline at end of file +``` + +## Standard Library + +The tools in `repl/` includes a standard library, which can be added to the root VM by calling `initStandardLibrary` just before `Toy_runVM`. It provides the following general purpose functions: + +* `min(x, y)` +* `max(x, y)` +* `floor(x)` +* `ceil(x)` +* `sqrt(x)` +* `range(x)` + +It also offers an example of how to write an API. + +*Note: Range returns a closure intended for use in the `for` keyword, but the that keyword isn't done yet.* \ No newline at end of file