ludic/ns-world.html
2026-09-17 22:10:03 +00:00

22 lines
No EOL
4.4 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>World — Ludic</title>
<meta name="description" content="Runtime reflection over the ECS world — read and write component fields by id, spawn and inspect entities, and register components at runtime.">
<link rel="stylesheet" href="base.css">
<link rel="stylesheet" href="docs.css">
</head>
<body>
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
<main class="wrap item">
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <span class="here">World</span></div>
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">World</h1></div>
<p class="ns-blurb">Runtime reflection over the ECS world — read and write component fields by id, spawn and inspect entities, and register components at runtime. The introspection layer a mod uses.</p>
<div class="ns-methods"><a class="ns-method" href="world-get.html"><code class="nm-sig">World.get(prop_id, field_id, entity) -&gt; int</code><span class="nm-tip">Read a component field by id.</span></a><a class="ns-method" href="world-set.html"><code class="nm-sig">World.set(prop_id, field_id, entity, value) -&gt; void</code><span class="nm-tip">Write a component field by id.</span></a><a class="ns-method" href="world-has.html"><code class="nm-sig">World.has(entity, prop_id) -&gt; int</code><span class="nm-tip">Does an entity have a component?</span></a><a class="ns-method" href="world-count.html"><code class="nm-sig">World.count() -&gt; int</code><span class="nm-tip">The number of live entities.</span></a><a class="ns-method" href="world-size.html"><code class="nm-sig">World.size() -&gt; int</code><span class="nm-tip">The serialized size of the world.</span></a><a class="ns-method" href="world-spawn.html"><code class="nm-sig">World.spawn(model_id) -&gt; entity</code><span class="nm-tip">Spawn an entity of a model by id.</span></a><a class="ns-method" href="world-save.html"><code class="nm-sig">World.save(buf) -&gt; int</code><span class="nm-tip">Serialize the world into a buffer.</span></a><a class="ns-method" href="world-load.html"><code class="nm-sig">World.load(buf, len) -&gt; void</code><span class="nm-tip">Restore the world from a buffer.</span></a><a class="ns-method" href="world-prop_id.html"><code class="nm-sig">World.prop_id(name) -&gt; int</code><span class="nm-tip">Look up a component's id by name.</span></a><a class="ns-method" href="world-field_id.html"><code class="nm-sig">World.field_id(prop_id, name) -&gt; int</code><span class="nm-tip">Look up a field's id by name.</span></a><a class="ns-method" href="world-model_id.html"><code class="nm-sig">World.model_id(name) -&gt; int</code><span class="nm-tip">Look up a model's id by name.</span></a><a class="ns-method" href="world-kind.html"><code class="nm-sig">World.kind(entity) -&gt; int</code><span class="nm-tip">The model id of an entity.</span></a><a class="ns-method" href="world-register_prop.html"><code class="nm-sig">World.register_prop(name, size) -&gt; int</code><span class="nm-tip">Register a new component at runtime.</span></a><a class="ns-method" href="world-attach.html"><code class="nm-sig">World.attach(entity, prop_id) -&gt; void</code><span class="nm-tip">Attach a component to an entity at runtime.</span></a><a class="ns-method" href="world-detach.html"><code class="nm-sig">World.detach(entity, prop_id) -&gt; void</code><span class="nm-tip">Detach a component from an entity at runtime.</span></a><a class="ns-method" href="world-query_next.html"><code class="nm-sig">World.query_next(query_id, cursor) -&gt; int</code><span class="nm-tip">Advance a reflective query.</span></a><a class="ns-method" href="world-despawn.html"><code class="nm-sig">World.despawn(entity)</code><span class="nm-tip">Despawn an entity by id — runs its @OnDespawn hooks and frees the slot.</span></a></div>
<a class="back" href="api.html">← All symbols</a>
</main>
<script src="ludic-highlight.js"></script>
<script>Ludic.installCards(); Ludic.flashTarget();</script>
</body></html>