Lua Minecraft ComputerCraft 功能问题

以下是我的函数:

function button1()
    mon.clear()
    sleep(.25)
    shell.run("movie")
end

错误提示:shell.run("movie")这一行出现了“尝试索引空值”此类的错误。

点赞
用户4383115
用户4383115

我发现了问题。

你不能使用os.loadAPI()从另一个程序调用shell.run()

2014-12-23 20:02:10
用户4777725
用户4777725

所以你已经声明了mon变量和function()函数,有两种选择:

  1. 将该命令改成shell.run("monitor side movie")

  2. 重写该程序,将函数中的mon.setCursorPos(1.1)替换为term.setCursorPos(1,1),然后运行程序时输入monitor side program即可。

2015-07-19 02:50:29