插件api copyHandler:InitWithItems 使用 参数报错

[14:02:06] LuaException: c# exception:This type must add to CSharpCallLua: System.Collections.Generic.IList`1[FairyEditor.FPackageItem],stack:  at XLua.ObjectCasters+<>c__DisplayClass23_0.<genCaster>b__3 (System.IntPtr L, System.Int32 idx, System.Object target) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.ObjectCast.Invoke (System.IntPtr L, System.Int32 idx, System.Object target) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.OverloadMethodWrap.Call (System.IntPtr L) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.MethodWrap.Call (System.IntPtr L) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Diagnostics.Tracing.EnumHelper`1+Transformer`1[UnderlyingType,ValueType].Invoke (ValueType value) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.StaticLuaCallbacks.FixCSFunction (System.IntPtr L) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.LuaDLL.Lua.lua_pcall (System.IntPtr L, System.Int32 nArgs, System.Int32 nResults, System.Int32 errfunc) [0x00000] in <00000000000000000000000000000000>:0 
  at XLua.DelegateBridge.__Gen_Delegate_Imp35 (System.String p0) [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.Events.UnityAction.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventBridge.CallInternal (FairyGUI.EventContext context) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.InternalDispatchEvent (System.String strType, FairyGUI.EventBridge bridge, System.Object data, System.Object initiator) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.DispatchEvent (System.String strType, System.Object data) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.PopupMenu.__clickItem (FairyGUI.EventContext context) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventBridge.CallInternal (FairyGUI.EventContext context) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.InternalDispatchEvent (System.String strType, FairyGUI.EventBridge bridge, System.Object data, System.Object initiator) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.DispatchEvent (System.String strType, System.Object data) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventBridge.CallInternal (FairyGUI.EventContext context) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.BubbleEvent (System.String strType, System.Object data, System.Collections.Generic.List`1[T] addChain) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.EventDispatcher.BubbleEvent (System.String strType, System.Object data) [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.Stage.HandleMouseEvents () [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.Stage.HandleEvents () [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.Stage.InternalUpdate () [0x00000] in <00000000000000000000000000000000>:0 
  at FairyGUI.StageEngine.LateUpdate () [0x00000] in <00000000000000000000000000000000>:0 
stack traceback:
[C]: in method 'InitWithItems'
[string "Plugin-test_case"]:28: in upvalue 'test_move_res'
[string "Plugin-test_case"]:55: in upvalue 'run'
[string "Plugin-test_case"]:62: in function <[string "Plugin-test_case"]:61>
XLua.LuaEnv.ThrowExceptionFromError (System.Int32 oldTop) (at <00000000000000000000000000000000>:0)
XLua.DelegateBridge.__Gen_Delegate_Imp35 (System.String p0) (at <00000000000000000000000000000000>:0)
UnityEngine.Events.UnityAction.Invoke () (at <00000000000000000000000000000000>:0)
FairyGUI.EventBridge.CallInternal (FairyGUI.EventContext context) (at <00000000000000000000000000000000>:0)
FairyGUI.EventDispatcher.InternalDispatchEvent (System.String strType, FairyGUI.EventBridge bridge, System.Object data, System.Object initiator) (at <00000000000000000000000000000000>:0)
...
 
代码:


2021315-141251.png

 
已邀请:

谷主

赞同来自:

你看接口需要什么,你传luatable怎么可能行

fgui_learner

赞同来自:

---@param dropTarget CS.FairyEditor.FPackageItem
---@param items CS.System.Collections.Generic.List_CS.FairyEditor.FPackageItem
function CS.FairyEditor.View.LibraryView:MoveResources(dropTarget, items) end
这个 System.Collections.Generic.List 的items参数可以直接传的table。
 

---@param items CS.System.Collections.Generic.IList_CS.FairyEditor.FPackageItem
---@param targetPkg CS.FairyEditor.FPackage
---@param targetPath string
---@param seekLevel number
function CS.FairyEditor.CopyHandler:InitWithItems(items, targetPkg, targetPath, seekLevel) end
CS.System.Collections.Generic.IList  这个类型的传table就报错,那xlua这边还能怎么传这个类型的

fgui_learner

赞同来自:

是否需要给这个接口类型加标签   https://blog.csdn.net/qq_39099 ... 20871

要回复问题请先登录注册