链接组装

我尝试制作一个脚本,让一个特定的程序打开链接,但它只打开了一部分,有人可以帮忙吗?

elseif result == "GOTO_ULTRABOOK_LEVEL" then
local randomLevelDigit = _G.math.random(1, 14)
local lvlURL = "https://ab-in-adventure.appspot.com/embed?levelId=1-" .. randomLevelDigit .. "&levelName=level-" ..    randomLevelDigit
local basilisk = "Basilisk-Portable.exe"
--openURL()
_G.os.execute(basilisk, lvlURL)
点赞
用户2858170
用户2858170

_G.os.execute(basilisk, lvlURL) 不起作用。第二个参数 lvlURL 被忽略了,因为 os.execute 只接受一个字符串参数。

在手册中,你会找到 os.execute ([command])。这告诉你 os.execute 有一个可选参数。单个参数是因为括号中没有其他内容。可选的是因为它在方括号中。

所以为了使它起作用,只需将完整的 shell 命令作为单个字符串提供给 os.execute

由于您已经在片段中使用了字符串连接运算符,所以您知道该怎么做。

2021-05-12 06:10:58