This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
TheRavenBlue's profile picture

startup:3: index ecpected, got nil

Started by TheRavenBlue, 11 July 2013 - 05:27 AM
TheRavenBlue #1
Posted 11 July 2013 - 07:27 AM
Im trying to create a password protected secret entrance on the floor that is powered by frame engine ( thats why i need it to pulse the redstone signal) but i keep on getting: startup:3: index ecpected, got nil when rebooting here is the thingy:

    term.clear()
    term.setCursorPos(1,1)
    ps.pullEvent = os.pullEventRaw
	
    password = "close"
    masterpassword = "open"
	
    print("To colse type: close To open type: open")
    write "Password:"
    local input = read("*")
	
    if input == (password) then
    print("Door Closing STAND BACK")
    redstone.setOutput("back",true)
    sleep(2)
    redstone.setOutput("back",true)
    sleep(2)
    redstone.setOutput("back",true)
    sleep(2)
    os.shutdown()
	
    elseif input == (masterpassword) then
    print("Door Opening STAND BACK")
    redstone.setOutput("top",true)
    sleep(2)
    redstone.setOutput("top",true)
    sleep(2)
    redstone.setOutput("top",true)
    os.shutdown()
	
    else
	
    print("Unknown Command, Check Spelling")
    sleep(2)
    os.shutdown()
	
    end

Lyqyd #2
Posted 11 July 2013 - 01:40 PM
Split into new topic.

It's os.pullEvent, not ps.pullEvent.
MR_nesquick #3
Posted 11 July 2013 - 02:50 PM

write "password: "
missing: ()


restone.setOutput("back",true)
sleep(2)

restone.setOutput("back",true)
sleep(2)

restone.setOutput("back",true)
sleep(2)

redstone = true 3 times


you can use "for" loops instead of copy and paste your code

for i = 1, 3 do
restone.setOutput("back",true)
sleep(2)
restone.setOutput("back",false)
sleep(2)
end


Computercraft wiki about loops http://www.computerc...php?title=Loops
Lyqyd #4
Posted 11 July 2013 - 02:55 PM
The first one actually works fine in Lua, strangely enough. A function call with a single string literal argument does not require the parentheses.