Example #1
0
        public GotchiStatusLuaScript(string scriptFilePath)
        {
            _script = LuaUtils.CreateAndInitializeScript();

            if (System.IO.File.Exists(scriptFilePath))
            {
                _script.DoFile(scriptFilePath);
            }
        }
        public async Task RegisterAsync(string typeFilePath)
        {
            Script script = LuaUtils.CreateAndInitializeScript();

            try {
                await script.DoFileAsync(typeFilePath);

                GotchiType type = new GotchiType();

                script.Call(script.Globals["OnRegister"], type);

                _registry.Add(type);
            }
            catch (Exception) {
                await _logAsync(LogSeverity.Error, string.Format("Failed to register type {0}", System.IO.Path.GetFileName(typeFilePath)));
            }
        }