简体   繁体   中英

Lua Minecraft ComputerCraft function issue

Okay so here is my function:

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

Says: "attempt to index ? (a nil value)" for the shell.run("movie") line

I found out the problem.

You can't call shell.run() from another program using os.loadAPI()

so you have declared the mon variable and the function() there are two choices

  1. switch the this command to shell.run("monitor side movie")

  2. rewrite the program and in the function replace mon.setCursorPos(1.1) to term.setCursorPos(1,1) then when you run the program type "monitor side program" ok

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM