scheduler

This commit is contained in:
Jill 2022-09-19 21:43:41 +03:00
parent daa4e52b37
commit 141b1947b1
2 changed files with 26 additions and 1 deletions

View File

@ -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.

@ -1 +1 @@
Subproject commit 34fac4aa998198205cc930ee6cb19d9a5b01974e
Subproject commit dfb89ab405dad62c1d64a7f4456b8f002f8db8f4