function countLinkedListNodes(nodeAddress) local counter = 0 local next = readInteger(nodeAddress) while (next ~= nodeAddress) do counter = counter + 1 next = readInteger(next) end return counter end