Example #1
0
        private void Awake()
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);

            sw.Start();

            Luna.ReadBytes = ReadBytes;

            loader = new ResScriptLoader
            {
#if LUNA_SCRIPT
                ScriptPath = "luna/"
#else
                ScriptPath = "lua/"
#endif
            };

            loader.AddSearchPath("core");
            loader.AddSearchPath("math");

            OnPreInit();

            sw.Stop();

            Debug.Log($"Luna preinit time : {sw.ElapsedMilliseconds} ms");

            sw.Start();

            luna           = new Luna(modules.ToArray());
            luna.PostInit += OnPostInit;

            OnInit();

            sw.Stop();

            Debug.Log($"Luna init time : { sw.ElapsedMilliseconds} ms");

            sw.Start();

            luna.Start();

            sw.Stop();

            Debug.Log($"Luna start time : {sw.ElapsedMilliseconds} ms");

            LunaCreate?.Invoke(luna);
        }
Example #2
0
        public void Start()
        {
            GenerateWraps();

            luna.Start();
            luna.AddSearcher(Loader);

            var L = luna.State;

            lua_requiref(L, "pb", LunaNative.luaopen_pb);
            LunaNative.luaopen_cjson(L);

            luna.DoFile("vec3.luna");

            Converter.RegUnmanagedConverter <vec3>(L);

            luna.DoFile("TestValue.luna");
            Converter.Register <TestValue>(new TestValueTypeConverter(L));
        }