Hi everyone i was testing some code (with some theoriginalbit contributions) and the following error appeared:
ccpoly:34: bad argument #1: value expected, and i dont really know what that means or what i can do to fix it, here is the code
Spoiler

rednet.open("bottom")
--# reads a number from the user
local function readNum()
  --# read a number
  local input = tonumber(read())
  --# while it is not a number
  while not input do
	--# tell them off
	print("Not a number")
	--# read a number
	input = tonumber(read())
  end
  --# return the number
  return input
end

--# use these two variables throughout your code
--# this one is how many players there are
local numPlayers = 0
--# this is the players name as the key and the turtles id as the value
local playerInfo = {}

--# if there is a save game
if fs.exists('.savegame') then
  --# attempt to open the file
  local h = fs.open('.savegame', 'r')
  --# read the number of players
  numPlayers = tonumber(h.readLine())
  --# read the player names and their turtle IDs
  for i = 1, numPlayers do
	--# read the player name
	local pn = h.readLine()
	--# insert the turtle id into the players table so we know which turtle relates to which player
	playerInfo[pn] = tonumber(h.readLine())
  end
  --# close the file
  h.close()
--# there was no save file
else
  --# open the file
  local h = fs.open('.savegame', 'w')

  --# ask for number of players
  write("Number of players: ")
  numPlayers = readNum()

  --# save the number of players
  h.writeLine(numPlayers)

  --# a place to temp store player names under IDs so there cannot be duplicate turtle ids for players
  local reverseLookup = {}

  --# loop for number of players
  for i = 1, numPlayers do
	--# ask for the players name
	print("Player #"..i)
	write("Name:")
	local pn = read()
	--# if this name is already used
	while playerInfo[pn] do
	  print("Player with that name already exists")
	  pn = read()
	end

	--# get the turtle id
	write("Turtle ID:")
	local ti = readNum()
	--# if there is an id already used
	while reverseLookup[ti] do
	  print("ID in use by another player")
	  ti = readNum()
	end

	--# save the info into the tables
	playerInfo[pn] = ti
	--# save the reverse lookup so there cannot be dupe ids
	reverseLookup[ti] = pn

	--# save the player name and turtle ID
	h.writeLine(pn)
	h.writeLine(ti)
	--# write the name and id to file
	h.flush()
  end
  --# close the file
  h.close()
end