Собственно есть двумерный массив
WeatherInWorld = {},{}
А одном месте выполняю этот код
WeatherInWorld[2][1] = CreateAdjacentWeather(WeatherInWorld[1][4], month)
WeatherInWorld[2][2] = CreateAdjacentWeather(WeatherInWorld[2][1], month)
WeatherInWorld[2][3] = CreateAdjacentWeather(WeatherInWorld[2][2], month)
WeatherInWorld[2][4] = CreateAdjacentWeather(WeatherInWorld[2][3], month)
Вот Function CreateAdjacentWeather
function CreateAdjacentWeather(x, y)
if(y == 1)
then
if(x == 1)
then
return 1
else
return 0
end
else
return 0
end
end
Суть функции думаю поняли (в реальности она такая же,только чуть больше условных конструкций)
В итоге ошибка
attempt to index field ' ' (a nil value)
на
WeatherInWorld[2][1] = CreateAdjacentWeather(WeatherInWorld[1][4], month)
WeatherInWorld[2][2] = CreateAdjacentWeather(WeatherInWorld[2][1], month)
WeatherInWorld[2][3] = CreateAdjacentWeather(WeatherInWorld[2][2], month)
WeatherInWorld[2][4] = CreateAdjacentWeather(WeatherInWorld[2][3], month)
Что исправить надо и как?И,вообще в чём косяк?