Add LuaDeprecatedMethodAttribute and apply to client.transformPointX/Y
This commit is contained in:
parent
0437de604b
commit
7797689c53
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
namespace BizHawk.Client.Common
|
namespace BizHawk.Client.Common
|
||||||
{
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
|
||||||
|
public sealed class LuaDeprecatedMethodAttribute : Attribute {}
|
||||||
|
|
||||||
[AttributeUsage(AttributeTargets.Method)]
|
[AttributeUsage(AttributeTargets.Method)]
|
||||||
public sealed class LuaMethodAttribute : Attribute
|
public sealed class LuaMethodAttribute : Attribute
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ __Types and notation__
|
||||||
** A standard Lua table
|
** A standard Lua table
|
||||||
");
|
");
|
||||||
|
|
||||||
foreach (var library in this.Select(lf => new { Name = lf.Library, Description = lf.LibraryDescription }).Distinct())
|
foreach (var library in this.Where(lf => !lf.IsDeprecated).Select(lf => new { Name = lf.Library, Description = lf.LibraryDescription }).Distinct())
|
||||||
{
|
{
|
||||||
sb
|
sb
|
||||||
.AppendFormat("%%TAB {0}%%", library.Name)
|
.AppendFormat("%%TAB {0}%%", library.Name)
|
||||||
|
@ -166,6 +166,7 @@ __Types and notation__
|
||||||
_luaExampleAttribute = method.GetCustomAttribute<LuaMethodExampleAttribute>(false);
|
_luaExampleAttribute = method.GetCustomAttribute<LuaMethodExampleAttribute>(false);
|
||||||
_method = method;
|
_method = method;
|
||||||
|
|
||||||
|
IsDeprecated = method.GetCustomAttribute<LuaDeprecatedMethodAttribute>(false) != null;
|
||||||
Library = library;
|
Library = library;
|
||||||
LibraryDescription = libraryDescription;
|
LibraryDescription = libraryDescription;
|
||||||
}
|
}
|
||||||
|
@ -173,6 +174,8 @@ __Types and notation__
|
||||||
public string Library { get; }
|
public string Library { get; }
|
||||||
public string LibraryDescription { get; }
|
public string LibraryDescription { get; }
|
||||||
|
|
||||||
|
public readonly bool IsDeprecated;
|
||||||
|
|
||||||
public MethodInfo Method => _method;
|
public MethodInfo Method => _method;
|
||||||
|
|
||||||
public string Name => _luaAttributes.Name;
|
public string Name => _luaAttributes.Name;
|
||||||
|
|
|
@ -373,10 +373,12 @@ namespace BizHawk.Client.EmuHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma warning disable CS0612
|
#pragma warning disable CS0612
|
||||||
|
[LuaDeprecatedMethod]
|
||||||
[LuaMethodExample("local inclitra = client.transformPointX( 16 );")]
|
[LuaMethodExample("local inclitra = client.transformPointX( 16 );")]
|
||||||
[LuaMethod("transformPointX", "Transforms an x-coordinate in emulator space to an x-coordinate in client space")]
|
[LuaMethod("transformPointX", "Transforms an x-coordinate in emulator space to an x-coordinate in client space")]
|
||||||
public static int TransformPointX(int x) => ClientApi.TransformPointX(x);
|
public static int TransformPointX(int x) => ClientApi.TransformPointX(x);
|
||||||
|
|
||||||
|
[LuaDeprecatedMethod]
|
||||||
[LuaMethodExample("local inclitra = client.transformPointY( 32 );")]
|
[LuaMethodExample("local inclitra = client.transformPointY( 32 );")]
|
||||||
[LuaMethod("transformPointY", "Transforms an y-coordinate in emulator space to an y-coordinate in client space")]
|
[LuaMethod("transformPointY", "Transforms an y-coordinate in emulator space to an y-coordinate in client space")]
|
||||||
public static int TransformPointY(int y) => ClientApi.TransformPointY(y);
|
public static int TransformPointY(int y) => ClientApi.TransformPointY(y);
|
||||||
|
|
Loading…
Reference in New Issue