MoonSharp 使用外部模块

            var jsonMPath = "modules\\json.lua".GetDLLRunDir();
            if (!File.Exists(jsonMPath)) throw new Exception($"modules\\json.lua 不存在!");

            Script script = new Script();
            var dv = script.DoFile(jsonMPath);
            script.Globals["json"] = dv;

            var scriptCode = $@"
t=json.encode({{1,2,3}});
return t
";
            DynValue res = script.DoString(scriptCode);

  

posted @ 2020-07-22 18:51  我的用户名  阅读(212)  评论(0编辑  收藏  举报