Lua FFI to Rust

Hello all you forum people!

I recently wrote a small rust cdylib that is called from OBS using lua. The library fetches the next challenger on lichess.org.

It is the first time i've used threading in rust.

I would appreciate feedback on the project.

The project is here on github.

Thanks in advance!

2 Likes

I can't give well-funded feedback as I never used the "ffi" library in Lua, but thanks for sharing.

I don't understand what this line does:

obs = obslua

Who (or what) defines obslua at that stage?

Hey no problem.

OBS uses a built in version of LuaJit. When OBS sets up the JIT environment, it creates an object called obslua (or if your creating a python script obspython) which contains various predefined methods that you can use to hook into the OBS internals.

All obs = obslua does is assign obslua to a variable called obs, it just saves 3 letters worth of typing :sweat_smile:.

If you are interested in making script plugins for OBS, you can check out the docs.