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);