首页 > 其他 > 详细

MoonSharp 使用外部模块

时间:2020-07-22 21:06:07      阅读:66      评论:0      收藏:0      [点我收藏+]
            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);

  

MoonSharp 使用外部模块

原文:https://www.cnblogs.com/huawublog/p/13362578.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!