Skip to content
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

CheckDelegateType #236

Open
mx5566 opened this issue Jul 1, 2021 · 0 comments
Open

CheckDelegateType #236

mx5566 opened this issue Jul 1, 2021 · 0 comments

Comments

@mx5566
Copy link

mx5566 commented Jul 1, 2021

如果有两个同名的函数例如生成的中间代码如下
` int count = LuaDLL.lua_gettop(L);

		if (count == 3 && TypeChecker.CheckTypes<int, OnSceneIndexChanged>(L, 2))
		{
			SceneMgr obj = (SceneMgr)ToLua.CheckObject<SceneMgr>(L, 1);
			int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
			OnSceneIndexChanged arg1 = (OnSceneIndexChanged)ToLua.ToObject(L, 3);
			obj.LoadSceneAsync(arg0, arg1);
			return 0;
		}
		else if (count == 3 && TypeChecker.CheckTypes<string, OnSceneNameChanged>(L, 2))
		{
			SceneMgr obj = (SceneMgr)ToLua.CheckObject<SceneMgr>(L, 1);
			string arg0 = ToLua.ToString(L, 2);
			OnSceneNameChanged arg1 = (OnSceneNameChanged)ToLua.ToObject(L, 3);
			obj.LoadSceneAsync(arg0, arg1);
			return 0;
		}
		else
		{
			return LuaDLL.luaL_throw(L, "invalid arguments to method: SceneMgr.LoadSceneAsync");
		}`

TypeChecker.CheckTypes<string, OnSceneNameChanged>最终在调用 CheckDelegateType 无法检测LuaTypes.LUA_TFUNCTION

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant