tm.ready
Readiness check for resources that follow the Client.ready / Server.ready / Shared.ready convention. Shared.
Client, Server and Shared are per-resource globals, so another resource cannot read them. A resource that loads this import exposes its own flag through one export, tmReady, and isReady calls it.
lua
if tm.ready.isReady('some_resource') then ... end
local ok = tm.ready.wait('some_resource', 10000) -- blocks the thread, false on timeout| Function | Notes |
|---|---|
isReady(name?) | name defaults to this resource. A resource is ready when it is started and its flag is true. The flag is Server.ready on the server and Client.ready on the client, then Shared.ready. An explicit false means not ready. A resource with no flag counts as ready once it is running. A positive answer is cached until that resource stops. |
wait(name, timeout?) | Blocks the calling thread (polls every 100 ms) until ready. Returns false after timeout ms (default 30000). |
Imports load lazily. A resource that wants others to see its flag should preload the import with a tm 'ready' line in its manifest. Until the import has run in that resource, others see it as having no flag, so it counts as ready as soon as it is started.