From 141b1947b1272488f0e2e88d408fe23dd82b8ee0 Mon Sep 17 00:00:00 2001 From: "Jill \"oatmealine\" Monoids" Date: Mon, 19 Sep 2022 21:43:41 +0300 Subject: [PATCH] scheduler --- MANUAL.md | 25 +++++++++++++++++++++++++ template | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/MANUAL.md b/MANUAL.md index 41ede6d..f72c6eb 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -76,6 +76,11 @@ Uranium Template originally formed during the creation of a currently unreleased - [`input`](#input) - [A note about keyboard inputs](#a-note-about-keyboard-inputs) - [`bitop`](#bitop) + - [`scheduler`](#scheduler) + - [`schedule(when: number, func: function): number`](#schedulewhen-number-func-function-number) + - [`scheduleInTicks(when: number, func: function): number`](#scheduleintickswhen-number-func-function-number) + - [`unschedule(i: index): void`](#unschedulei-index-void) + - [`unscheduleInTicks(i: index): void`](#unscheduleinticksi-index-void) - [`rng`](#rng) - [`rng.init(seed: number[] | nil): rng`](#rnginitseed-number--nil-rng) - [`rng(a: number | nil, b: number | nil): number`](#rnga-number--nil-b-number--nil-number) @@ -557,6 +562,26 @@ local isDebugKeyAndShiftHeld = isDebugKeyHeld and special.shift A Lua 5.0 port of [bitop-lua](https://github.com/AlberTajuelo/bitop-lua). See their repository for documentation. +### `scheduler` + +A simple scheduler. + +#### `schedule(when: number, func: function): number` + +Schedules a function to run in a specific amount of time. `when` is in seconds. + +#### `scheduleInTicks(when: number, func: function): number` + +Schedules a function to run in a specific amount of `uranium.update` calls/ticks. + +#### `unschedule(i: index): void` + +Unschedules a function. Use the index returned to you when originally scheduling the function. + +#### `unscheduleInTicks(i: index): void` + +Unschedules a function in ticks. Use the index returned to you when originally scheduling the function. + ### `rng` A xoshiro128** reimplementation in Lua. diff --git a/template b/template index 34fac4a..dfb89ab 160000 --- a/template +++ b/template @@ -1 +1 @@ -Subproject commit 34fac4aa998198205cc930ee6cb19d9a5b01974e +Subproject commit dfb89ab405dad62c1d64a7f4456b8f002f8db8f4