-
Notifications
You must be signed in to change notification settings - Fork 201
attributes_zh
YANG Huan edited this page Dec 29, 2020
·
5 revisions
可以在文档注释中标记一些属性,来控制编译器的行为。
/// <summary>
/// @CSharpLua.NoField
/// </summary>
public int Field { get; set; }
自动属性不会处理成字段,会生成对应的get、set函数。
/// <summary>
/// @CSharpLua.Ignore
/// </summary>
public class A { }
此类不会导出到生成的lua文件中,此属性可作用在类、方法、属性。
public static class Api {
/// <summary>
/// @CSharpLua.Template = "print({0})"
/// </summary>
public extern static void Print(object a);
/// <summary>
/// @CSharpLua.Template = "print({0}, {1})"
/// </summary>
public extern static void Print(object a, object b);
/// <summary>
/// @CSharpLua.Template = "print({*0})"
/// </summary>
public extern static void Print(params object[] args);
}
此属性可作用于方法和字段。模板编写规则可参考如何控制生成的类、方法的名字中的1部分的说明
/// <summary>
/// @CSharpLua.Params
/// </summary>
public static void Print(string format, params object[] args)
{
}
output
Print = function (format, ...)
end