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

[lua][Error] attempt to index ? (a number value)

Started by Ninja_assasin911, 31 March 2013 - 08:06 AM
Ninja_assasin911 #1
Posted 31 March 2013 - 10:06 AM
i am trying to make a password server to control all computer passwords wirelessly. On the computer with the password i keep getting the same error when i type the password correctly. The error is lock:20: attempt to index ? (a number value). If someone could please help me it would be greatly appreciated.

Here is the code: http://pastebin.com/3AyFRHD3

I did not make this code, i copied a video from youtube. All credit goes to him. Here is the link to the video: http://www.youtube.com/watch?v=NF9RwBBS60Q
He posted the source code for the server computer, but did not post the code for the client computers. so i copied his screen from the video.
TheOddByte #2
Posted 31 March 2013 - 11:40 AM
Well.. I noticed directly that on line 6

local myId = os.computerID()
Should be

local myId = os.getComputerID()


Or does the first one work?
Since I have never tested it..


But the real error is this

rednet.send(serverId.password)

The error is that you've put a '.' instead of ','
So it should be


rednet.send(serverId,password)
Dlcruz129 #3
Posted 31 March 2013 - 12:27 PM
Well.. I noticed directly that on line 6

local myId = os.computerID()
Should be

local myId = os.getComputerID()


Or does the first one work?
Since I have never tested it.

Either one works fine. ;)/>
LNETeam #4
Posted 31 March 2013 - 03:32 PM
If you want a good example for how this works and maybe some ideas, check out: http://www.computercraft.info/forums2/index.php?/topic/11200-151-lnexi-security-system-v7043/page__fromsearch__1. It's something I made and uses the same concept you have.
theoriginalbit #5
Posted 31 March 2013 - 03:42 PM
Well.. I noticed directly that on line 6

local myId = os.computerID()
Should be

local myId = os.getComputerID()

Or does the first one work?
Since I have never tested it..
Stupidly enough the devs have implemented

os.computerLabel()
os.getComputerLabel()
os.computerID()
os.getComputerID()
there is no point what so ever. but they have them.
Ninja_assasin911 #6
Posted 31 March 2013 - 08:29 PM
But the real error is this

rednet.send(serverId.password)

The error is that you've put a '.' instead of ','
So it should be


rednet.send(serverId,password)

I tried this and now it works perfectly. Thank you so much.