codemp/dist/lua
zaaarf d25e744a37
docs: improved cargo docs, rewrote readme
Co-authored-by: alemi <me@alemi.dev>
2024-09-05 01:45:48 +02:00
..
annotations.lua chore(lua): update annotations 2024-09-01 03:13:40 +02:00
build.sh feat(lua): added script 2024-08-14 23:46:45 +02:00
README.md docs: improved cargo docs, rewrote readme 2024-09-05 01:45:48 +02:00

Lua bindings

Lua allows directly requireing properly constructed shared objects, so glue code can live completely on the Rust side.

The Lua-compatible wrappers are built with mlua.

To build, just cargo build --release --features=lua and rename the resulting libcodemp.so / codemp.dll / codemp.dylib in codemp_native.so/dll/dylib. This is important because Lua looks up the constructor symbol based on filename.

Type hints are provided in annotations.lua, just include them in your language server: ---@module 'annotations'.

Example loader

A simple loader is provided here:

---@module 'annotations'

---@return Codemp
local function load()
	local native, _ = require("codemp.native")
	return native
end

return {
	load = load,
}