Wrapping C++ libraries into Luau bindings for Studio plugins


There is a C++ library I’d like to make available in Roblox Studio as a plugin. I have a SWIG wrapper for it, which can generate me required API bindings from the library in Lua (compatible with Lua 5.1, for example, which Luau claims to more or less support). How can I make that C++ library available to the Studio with the Lua bindings I generate for it and eventually turn it into a plug-in?

I am assuming I’d need a copy of Luau and build the generated bindings together with Luau’s code and then somehow make the result available in Studio… How?

So far I’ve seen people doing plugins using mostly Lua only. And this is the way the documentation instructs it as well:

1 Like

I imagine you hope to link your c++ library dynamically, but the luau implementation in the engine is closed for security reasons.

The best you can do is to provide your library as a service (on a local server) and use HttpService in your plugin to consume it. Rojo is written in rust and that’s what it does to work.

1 Like

I have no constraints to link it statically if needed, but I get your point.
Thanks about the Rojo mention; I will look into it. The library does have a REST API support that will need to be expanded somewhat, so I guess the HttpService might work… not sure how laggy it’d be; I’ll need to get to test it.