I'm trying to implement cutscenes for my game using LuaBridge. Right now I'm setting up the Cutscene State, which creates a Lua state, stores it, and loads a script. I'm trying to set the functions up, such as the Cutscene createSprite function.

I'm using this to set up the function:

luabridge::getGlobalNamespace(this->_lua).addFunction("createSprite", &this->createSprite);

I'm getting the compiler error:

error: no matching function for call to 'luabridge::FuncTraits<void (Cutscene::*)(function arguments), void (Cutscene::*)(function arguments)>::call(void (Cutscene::* const&)(function arguments), luabridge::ArgList<luabridge::TypeList<function arguments>)

note: candidate expects 3 arguments, 2 provided

It seems the call function it is trying to use takes three parameters: T*, D, and a big list of the types for the parameters. I left out my function arguments as they don't seem to be the problem and it's a big error message to begin with.

I just want to be able to use the member functions of this specific instance of Cutscene through my Lua script, preferably without having to specify it as a member of Cutscene in the script (eg. I want to be able to call this just using createSprite("name", "type", u, v, w, h) in Lua.) Is there any way to do this, or must I send the class over and figure some way to send my current instance of Cutscene to Lua? It has to be the specific instance as Sprites need to be saved to the Cutscene in order to access them by name later.


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.