- See [`env.d.tl`](../addon/defs/global_env.d.tl) for API definitions.
- Add-on can be executed only if the API version is compatible.
- Localization is handled by add-on.
### API Version Check
Add-on must implement `apiVersion` that takes no argument and returns `ApiVersion` ([`env.d.tl`](../addon/defs/global_env.d.tl)).
Before execution, Red Panda C++ will call `apiVersion()`_without injecting any API group_[^1] to check whether the add-on is compatible with current Red Panda C++ (host).
[^1]: Thus do not call any API (incl. Lua standard library) in `apiVersion` and file scope.
Add-on is compatible with host if and only if:
```
(add-on kind = host kind) ∧ (
((add-on major = host major = 0) ∧ (add-on minor = host minor)) ∨
((add-on major = host major ≥ 1) ∧ (add-on minor ≤ host minor))
)
```
That is to say:
- API version is kind-specific.
- For a given kind, API major reported by add-on must be equal to host major.
- API major = 0 means unstable, minor updates may break backward compatibility.
- API major ≥ 1 means stable, minor updates keep backward compatibility.
### Types
Types in Red Panda C++ add-on interface are defined in [Teal](https://github.com/teal-language/tl) language, a typed dialect of Lua.
To make use of the type definitions, add-on can be written in Teal. To check and compile Teal add-on: