New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DS架构下DS和客户端怎么同时使用LuaActor #199
Comments
LuaState::get() 返回的是第一个创建的state,他可以加参数,参数包括index,或者name 比如 LuaState::get("client"); LuaState::get("ds); |
理论上,ds和client分别都只会在各自的gameinstance创建属于自己的state,LuaState::get()不会产生问题,如果你确实创建个2个state,直接get分不清楚,可以考虑命名。 |
如果真机就不会有问题,但是编辑器开多玩家调试就会有问题,因为他们都是引用同一个静态变量。如果按你这样命名,多个client都叫client也分不清,他们也没办法提前知道自己该叫什么和别人区分开来。 |
可以考虑从gameinstance拿到对应的luastate |
我增加了基于GameInstance来getLuaState的支持,这样可以区分多开的的LuaState实例。 |
我在ds以及客户端各自的GameInstance中创建了动态的slua的LuaState之后,发现在LuaBas.h里面:
bool init(T* ptrT, const char* typeName, const FString& stateName, const FString& luaPath)
{
if (luaPath.IsEmpty())
return false;
}
发现ls在编辑器下竟然会返回一个静态的虚拟机地址,导致客户端和ds共享lua虚拟机。这里要怎么改才能使用各自的LuaState啊?没有考虑到支持这种架构吗?
The text was updated successfully, but these errors were encountered: