Minor fixes to examples in event tables document (#4322)

# Description of Changes

Use `accessor =` rather than `name =` in Rust code snippet which defines
event table.

Add `schema` call and `export default` to TypeScript code snippet which
defines event table. I'm not sure this is better, and it's certainly
more cluttered, but the example as written you can't just copy/paste
into your module code.

# API and ABI breaking changes

N/a

# Expected complexity level and risk

Docs only

# Testing

Described elsewhere.
This commit is contained in:
Phoebe Goldman
2026-02-17 16:33:31 -05:00
committed by GitHub
parent 40d7820002
commit f33188ab1b
@@ -28,6 +28,11 @@ const damageEvent = table({
damage: t.u32(),
source: t.string(),
});
const spacetimedb = schema({
damageEvent,
});
export default spacetimedb;
```
</TabItem>
@@ -47,7 +52,7 @@ public partial struct DamageEvent
<TabItem value="rust" label="Rust">
```rust
#[spacetimedb::table(name = damage_event, public, event)]
#[spacetimedb::table(accessor = damage_event, public, event)]
pub struct DamageEvent {
pub entity_id: Identity,
pub damage: u32,