30 lines
No EOL
2.3 KiB
HTML
30 lines
No EOL
2.3 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Member & index — Ludic</title>
|
||
<meta name="description" content="Field access, element index, and string slice — usable as value or target.">
|
||
<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> <a href="api.html#operators">Operators & tokens</a> <span>›</span> <span class="here">Member & index</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-operator">operator</span>
|
||
<h1 id="top">Member & index</h1>
|
||
</div>
|
||
<code class="sig">x.field buffer[i] text[a..b]</code>
|
||
<div class="desc"><p>The access operators reach into a compound value. <code>value.field</code> reads or writes a property field and chains freely (<code>route.next.column</code>); <code>buffer[index]</code> reads or writes one element of a slice or raw buffer; and <code>text[start..end]</code> produces a fresh substring of the bytes in the half-open range, while <code>text[index]</code> reads a single byte as an <code>int</code> code point. Each form works both as a <b>value</b> and as an <b>assignment target</b>, and they compose — <code>route[index].column = 0</code> is one address computation. Field access also binds method-style calls like <code>Screen.fill_rectangle</code>.</p></div>
|
||
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">let head_column: int = segments[0].column
|
||
segments[0].column = head_column + 1
|
||
let extension: string = file_name[len(file_name) - 4..len(file_name)]</pre></div>
|
||
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |