null与nil无法比较,进行判空
- 解决方法1
C#对象.Equals(nil) - 方法2
Lua中封装全局方法:
function IsNull()
if obj==nil or obj:Equals(nil) then
return true
end
return false
end
- 方法3
C#中封装拓展方法 使用对象为 object类型
[LuaCallCSharp]
public static class Lesson09
{
public static bool IsNull(this object obj)
{
return obj == null;
}
}