Closed xuhuanzy closed 10 months ago
namespace ConsoleApp1; public abstract class Platform { public abstract float GenerateRandomFloat(); } public abstract class Context { internal static Context Instance = null; private static Context GetInstance() { return Instance; } public static Platform Platform { get; internal set; } } public class MonogamePlatform : Platform { private System.Random Random = new System.Random(); public override float GenerateRandomFloat() { return (float)Random.NextDouble(); } } public class LuaContext : Context { static LuaContext() { Instance = new LuaContext(); Platform = new MonogamePlatform(); } public static void Update() { Console.WriteLine(LuaContext.Platform); Console.WriteLine(Context.Platform); } }
输出的lua只有
static = function (this) this.Instance = class() this.Platform = ConsoleApp1.MonogamePlatform() end
应该为元表赋值?
输出的lua只有
应该为元表赋值?