**LUA - ZeroBrane IDE: 编译功能**
2020-9-9 9:28:1
收藏:0
阅读:221
评论:1
如果我在 ZeroBrane Studio 中使用“项目 - 编译 (F7)”功能,会发生什么?
会创建 Lua 代码的独立 .exe 文件吗?
如果是这样的话,它会被创建在哪个目录中? 我使用的是 Windows 10。 (在文档中找不到任何信息)
点赞
评论区的留言会收到邮件通知哦~
推荐文章
- Lua 虚拟机加密load(string.dump(function)) 后执行失败问题如何解决
- 我想创建一个 Nginx 规则,禁止访问
- 如何将两个不同的lua文件合成一个 东西有点长 大佬请耐心看完 我是小白研究几天了都没搞定
- 如何在roblox studio中1:1导入真实世界的地形?
- 求解,lua_resume的第二次调用继续执行协程问题。
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?

根据我对源代码的快速查看,它只是通过使用
loadstring来加载文件并编译代码,检查代码是否有任何错误。 没有任何输出文件,只有有关任何错误的一些文本输出。但这只是一个假设。随意检查这是否是单击该按钮时实际调用的函数。
https://github.com/pkulchenko/ZeroBraneStudio/blob/5daf55d79449431ca9794f6b8a65476dc203b780/src/editor
function CompileProgram(editor, params) local params = { jumponerror = (params or {}).jumponerror ~= false, reportstats = (params or {}).reportstats ~= false, keepoutput = (params or {}).keepoutput, } local doc = ide:GetDocument(editor) local filePath = doc:GetFilePath() or doc:GetFileName() local loadstring = loadstring or load local func, err = loadstring(StripShebang(editor:GetTextDyn()), '@'..filePath) local line = not func and tonumber(err:match(":(%d+)%s*:")) or nil if not params.keepoutput then ClearOutput() end compileTotal = compileTotal + 1 if func then compileOk = compileOk + 1 if params.reportstats then ide:Print(TR("Compilation successful; %.0f%% success rate (%d/%d).") :format(compileOk/compileTotal*100, compileOk, compileTotal)) end else ide:GetOutput():Activate() ide:Print(TR("Compilation error").." "..TR("on line %d"):format(line)..":") ide:Print((err:gsub("\n$", ""))) -- check for escapes invalid in LuaJIT/Lua 5.2 that are allowed in Lua 5.1 if err:find('invalid escape sequence') then local s = editor:GetLineDyn(line-1) local cleaned = s :gsub('\\[abfnrtv\\"\']', ' ') :gsub('(\\x[0-9a-fA-F][0-9a-fA-F])', function(s) return string.rep(' ', #s) end) :gsub('(\\%d%d?%d?)', function(s) return string.rep(' ', #s) end) :gsub('(\\z%s*)', function(s) return string.rep(' ', #s) end) local invalid = cleaned:find("\\") if invalid then ide:Print(TR("Consider removing backslash from escape sequence '%s'.") :format(s:sub(invalid,invalid+1))) end end if line and params.jumponerror and line-1 ~= editor:GetCurrentLine() then editor:GotoLine(line-1) end end return func ~= nil -- 如果编译成功则返回 true end