Tencent / xLua

xLua is a lua programming solution for C# ( Unity, .Net, Mono) , it supports android, ios, windows, linux, osx, etc.
Other
9.21k stars 2.44k forks source link

unity2022生成wrap代码时报错 #1140

Open JunSongHan123 opened 1 month ago

JunSongHan123 commented 1 month ago

gen wrap file fail! err=TemplateCommon:200: attempt to index a nil value (field 'FullName') stack traceback: TemplateCommon:200: in upvalue '_CsFullTypeName' TemplateCommon:213: in function 'CsFullTypeName' [string "luatemplate"]:563: in local 'callback' TemplateCommon:145: in function 'ForEachCsList' [string "luatemplate"]:494: in local 'callback' TemplateCommon:145: in function 'ForEachCsList' [string "luatemplate"]:473: in main chunk, stack= at XLua.LuaEnv.ThrowExceptionFromError (System.Int32 oldTop) [0x00040] in E:\Project\FA_branch\client\Assets\Package\XLua\Src\LuaEnv.cs:465 at XLua.LuaFunction.Call (System.Object[] args, System.Type[] returnTypes) [0x0008f] in E:\Project\FA_branch\client\Assets\Package\XLua\Src\LuaFunction.cs:168 at XLua.LuaFunction.Call (System.Object[] args) [0x00001] in E:\Project\FA_branch\client\Assets\Package\XLua\Src\LuaFunction.cs:183 at XLua.TemplateEngine.LuaTemplate.Execute (XLua.LuaFunction compiledTemplate, XLua.LuaTable parameters) [0x00009] in E:\Project\FA_branch\client\Assets\Package\XLua\Src\TemplateEngine\TemplateEngine.cs:186 at CSObjectWrapEditor.Generator.GenOne (System.Type type, System.Action2[T1,T2] type_info_getter, CSObjectWrapEditor.XLuaTemplate templateAsset, System.IO.StreamWriter textWriter) [0x00095] in E:\Project\FA_branch\client\Assets\Package\XLua\Src\Editor\Generator.cs:611 0x00007ff601e1853d (Unity) StackWalker::GetCurrentCallstack 0x00007ff601e1d609 (Unity) StackWalker::ShowCallstack 0x00007ff602e015d1 (Unity) GetStacktrace 0x00007ff6034bb00e (Unity) DebugStringToFile 0x00007ff600de92e8 (Unity) DebugLogHandler_CUSTOM_Internal_Log 0x00000158ff3081ea (Mono JIT Code) (wrapper managed-to-native) UnityEngine.DebugLogHandler:Internal_Log (UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object) 0x00000158ff30805b (Mono JIT Code) UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) 0x00000158ff3074de (Mono JIT Code) UnityEngine.Logger:Log (UnityEngine.LogType,object) 0x00000158ff30717a (Mono JIT Code) UnityEngine.Debug:LogError (object) 0x00000158fe1572f3 (Mono JIT Code) CSObjectWrapEditor.Generator:GenOne (System.Type,System.Action2<System.Type, XLua.LuaTable>,CSObjectWrapEditor.XLuaTemplate,System.IO.StreamWriter) (at E:/Project/FA_branch/client/Assets/Package/XLua/Src/Editor/Generator.cs:621) 0x00000158fe1a10bb (Mono JIT Code) CSObjectWrapEditor.Generator:GenWrap (System.Collections.Generic.IEnumerable1<System.Type>,string) (at E:/Project/FA_branch/client/Assets/Package/XLua/Src/Editor/Generator.cs:1024) 0x00000158fe19ed93 (Mono JIT Code) CSObjectWrapEditor.Generator:Gen (System.Collections.Generic.IEnumerable1,System.Collections.Generic.IEnumerable1<System.Type>,System.Collections.Generic.IEnumerable1,string) (at E:/Project/FA_branch/client/Assets/Package/XLua/Src/Editor/Generator.cs:1587) 0x00000158fe19eb43 (Mono JIT Code) CSObjectWrapEditor.Generator:GenCodeForClass (bool) (at E:/Project/FA_branch/client/Assets/Package/XLua/Src/Editor/Generator.cs:1598) 0x00000158f7230e3b (Mono JIT Code) CSObjectWrapEditor.Generator:GenAll () (at E:/Project/FA_branch/client/Assets/Package/XLua/Src/Editor/Generator.cs:1665) 0x00000159265f6445 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr) 0x00007ffb923e4c1e (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445) 0x00007ffb9231d254 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3068) 0x00007ffb9231d3cc (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3115) 0x00007ff601d31284 (Unity) scripting_method_invoke 0x00007ff601d0eff4 (Unity) ScriptingInvocation::Invoke 0x00007ff601d0f0de (Unity) ScriptingInvocation::InvokeChecked 0x00007ff602b98e61 (Unity) ScriptCommands::InvokeMenuItemWithContext 0x00007ff602b96356 (Unity) ScriptCommands::Execute 0x00007ff6027a32d2 (Unity) MenuController::ExecuteMenuItem 0x00007ff602e085ff (Unity) ProcessMainWindowMessages 0x00007ff602e2a30e (Unity) ContainerWindow::ContainerWndProc 0x00007ffc6169ef75 (USER32) CallWindowProcW 0x00007ffc6169e69d (USER32) DispatchMessageW 0x00007ff602e07103 (Unity) MainMessageLoop 0x00007ff602e0c150 (Unity) WinMain 0x00007ff6041ee76e (Unity) __scrt_common_main_seh 0x00007ffc5fc87344 (KERNEL32) BaseThreadInitThunk 0x00007ffc61a226b1 (ntdll) RtlUserThreadStart

JunSongHan123 commented 1 month ago

open the TemplateCommon.lua.txt file, change the code in line:200. local name = t.FullName and t.FullName:gsub("&", ""):gsub("%+", ".") or "var"