Skip to content

Registering usertype function issues: "is_noexcept': undeclared identifier,'traits_type' is not class... #1021

@TwinHits

Description

@TwinHits

Hello!

I am having issues registering a new user type's functions. I am getting

'is_noexcept': undeclared identifier	
'traits_type': is not a class or namespace name
expression did not evaluate to a constant 

from function_types_stateless.hpp 173

on all four of these registration strategies:

this->luaState.set_function("moveRight", &TIEntityScriptInterface::moveRight);
this->luaState.new_usertype<TIEntityScriptInterface>("tientity", sol::no_constructor,
	"moveRight", &TIEntityScriptInterface::moveRight);
sol::usertype<TIEntityScriptInterface> interface_type = this->luaState.new_usertype<TIEntityScriptInterface>("tientity", "moveRight", &TIEntityScriptInterface::moveRight);
sol::usertype<TIEntityScriptInterface> interface_type = this->luaState.new_usertype<TIEntityScriptInterface>("tientity");
interface_type["moveRight"] = &TIEntityScriptInterface::moveRight; // Issue occurs when this line is introduced

Am I missing something from the documentation? (https://sol2.readthedocs.io/en/latest/tutorial/cxx-in-lua.html)

I'm on Windows 10, Visual Studio 2019, C++17, and I'm using sol v3.2.1.

Thank you!

For additional code, here's my TIEntityScriptInterface class:

class TIEntityScriptInterface {
    public:
        TIEntityScriptInterface(TIEntity&);
        ~TIEntityScriptInterface() {};

        void moveRight();
...

    private:
        TIEntity* tientity = nullptr;
};
void TIEntityScriptInterface::moveRight() {
    MovesComponent* movesComponent = this->tientity->getComponent<MovesComponent>();
    SpriteComponent* spriteComponent = this->tientity->getComponent<SpriteComponent>();
    if (movesComponent != nullptr) {
        MovesComponentSystem::Instance()->setTargetPosition(*movesComponent, *spriteComponent, Direction::RIGHT);
    }
}
...

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions