Skip to content

如何将基类也注册到lua中? #43

Answered by LanderlYoung
ThisisGame asked this question in Q&A
Discussion options

You must be logged in to vote

建议看看函数注释和详细的项目文档吧

看一下你的这段代码

class Camera:public Component,public script::ScriptClass
{
public:
    using script::ScriptClass::ScriptClass;
    Camera():Component(),script::ScriptClass(script::ScriptClass::ConstructFromCpp<Camera>{}) {}
};
  1. script::ScriptClass(script::ScriptClass::ConstructFromCpp<Camera>{})不是这么用的,文档里其实强调的很强烈了。
  2. 单测代码里有这个场景 https://github.com/Tencent/ScriptX/blob/main/test/src/NativeTest.cc#L715

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ThisisGame
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by LanderlYoung
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants