-
Notifications
You must be signed in to change notification settings - Fork 205
Description
`
using System;
using UnityEngine;
namespace CSLua
{
public class TestBase
{
public static Func<string, string> delegateSyncLoadUI = null;
}
public class TestClass : TestBase
{
}
public class Test1 : CSLua.LuaPage
{
}
public sealed class GameMain : MonoBehaviour {
public void Awake()
{
new TestClass();
}
}
}
`
当使用以上代码运行时,发现new TestClass()会失败。
编译后代码:
`
-- Generated by CSharp.lua Compiler 1.1.0
local System = System
local CSLua
System.usingDeclare(function (global)
CSLua = global.CSLua
end)
System.namespace("CSLua", function (namespace)
namespace.class("TestBase", function (namespace)
local staticCtor
staticCtor = function (this)
this.delegateSyncLoadUI = nil
end
return {
staticCtor = staticCtor
}
end)
namespace.class("TestClass", function (namespace)
local ctor
ctor = function (this)
this.base.ctor(this)
end
return {
inherits = function (global)
return {
global.CSLua.TestBase
}
end,
ctor = ctor
}
end)
namespace.class("Test1", function (namespace)
local ctor
ctor = function (this)
this.base.ctor(this)
end
return {
inherits = function (global)
return {
global.CSLua.LuaPage
}
end,
ctor = ctor
}
end)
namespace.class("GameMain", function (namespace)
local Awake
Awake = function (this)
CSLua.TestClass()
end
return {
inherits = function (global)
return {
global.UnityEngine.MonoBehaviour
}
end,
Awake = Awake
}
end)
end)
`
报错信息:
LuaException: D:/OWM_Client3/Assets/CSharpLua/Lua/CompiledScripts/CSLua/GameMain.lua:50: attempt to call field 'TestClass' (a table value)
stack traceback:
D:/OWM_Client3/Assets/CSharpLua/Lua/CompiledScripts/CSLua/GameMain.lua:50: in function 'Awake'
D:/OWM_Client3/Assets/CSharpLua/Lua/UnityAdapter.lua:240: in function 'ctor'
D:/OWM_Client3/Assets/CSharpLua/Lua/CoreSystemLua/CoreSystem/Core.lua:48: in function <D:/OWM_Client3/Assets/CSharpLua/Lua/CoreSystemLua/CoreSystem/Core.lua:46>