# 01 · two-level-inheritance **演示**:`Dog` 的元表 `__index` 指向 `Animal`,实例链为 Dog → Animal。 **运行时**:`lua54`、`luajit`。 **运行**: ```sh .tools/bin/lua54 scripts/run-example.lua examples/18-inheritance-and-mixins/01-two-level-inheritance .tools/bin/lua54 scripts/test-example.lua examples/18-inheritance-and-mixins/01-two-level-inheritance ``` **预期输出**(lua 5.4.9 / macOS arm64): ```text animal=cat makes a sound dog=rex barks ``` **看点**:继承是运行时元表链,不是编译期结构。 **注意**:`Dog.__index = Dog`,实例先查 Dog 再查 Animal。