MoonSharp 使用外部模块

Posted huawublog

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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);

  

以上是关于MoonSharp 使用外部模块的主要内容,如果未能解决你的问题,请参考以下文章

如何使用模块化代码片段中的LeakCanary检测内存泄漏?

如何从片段外部清除/重置地图?

html 将以编程方式附加外部脚本文件的javascript代码片段,并按顺序排列。用于响应式网站,其中ma

android:当用户触摸片段外部时,我如何关闭片段?

从外部片段内的 FragmentTabHost 的子片段添加新的选项菜单

如何有条件地将 C 代码片段编译到我的 Perl 模块?