# 01 · readonly-table **演示**:`__index` 代理读取,`__newindex` 抛错阻止写入。 **运行时**:`lua54`、`luajit`。 **运行**: ```sh .tools/bin/lua54 scripts/run-example.lua examples/15-index-and-newindex/01-readonly-table .tools/bin/lua54 scripts/test-example.lua examples/15-index-and-newindex/01-readonly-table ``` **预期输出**(lua 5.4.9 / macOS arm64): ```text value=8080 blocked=true ``` **看点**:只读表不是深冻结;嵌套表仍可改。 **注意**:`rawset` 可以绕过,属于约定而非安全边界。