我正在编写一个将包含相对路径的lua应用程序,无论在哪里安装lua,它都会将文件复制到clibs文件夹中
getPath = getWhereLuaInstalled (could be C:\program file(x86)\lua\5.1 or c:\lua\5.1..)
使用package.path将为我返回lua将搜索以找到可执行文件的所有路径。任何的想法?
谢谢
看来您正在为Windows计算机设计此文件(.dll,示例路径对此进行了说明),因此这是一种可能的解决方案。
local io = require "io"
function getWhereLuaInstalled()
local handle = io.popen('where lua')
local path = handle:read('*a'):match("(.*\\)")
handle:close()
return path
end
可以通过替换为Linux系统轻松地修改where lua
它which lua
。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句