2
이 코드가 계속 나타나지만 오류가 무엇인지 확실하지 않습니다. 누군가 그것을 알아내는 것을 도와 주실 수 있습니까? 그것이 64 행에 있다고합니다. 죄송합니다. 코드에 넣는 방법을 모르겠습니다. 다음은 오류 라인 코드입니다.LUA 오류 코드 64 : '?'필드를 색인화하려고 시도합니다. (없음 값)
if (array[j][1] < smallest) then
smallest = array[j][1]
index = j
end
--------- [ Element Data returns ] ---------
local function getData(theElement, key)
local key = tostring(key)
if isElement(theElement) and (key) then
return exports['[ars]anticheat-system']:c_callData(theElement, tostring(key))
else
return false
end
end
-------------- [ Scoreboard ] ---------------
local screenX, screenY = guiGetScreenSize()
local width, height = 300, 420
local x = (screenX/2) - (width/2)
local y = (screenY/2) - (height/2)
local logowidth, logoheight = 275, 275
local logox = (x/2) - (logowidth/2)
local logoy = (y/2) - (logoheight/2)
local isEventHandled = false
local page = 1
local a = { "Z", "W", "Y", "G", "H", "L", "P", "A", "B" }
function getPlayerIDTable()
local array = { }
for key, thePlayer in ipairs (getElementsByType("player")) do
local playerID = tonumber(getData(thePlayer, "playerid"))
if (playerID) then
array[#array + 1] = { playerID, thePlayer }
end
end
for i = 1, 9 do
local j = math.random(1, 9)
if (array[i] == nil) then
array[i] = { j, a[ math.random(1, 9) ] }
end
end
return array
end
local players = { }
function assemblePlayersByID()
local array = getPlayerIDTable()
local smallest, index, tempo
for i = 1, #array do
smallest = array[i][1]
index = i
for j = i + 1, #array do
if (array[j][1] < smallest) then
smallest = array[j][1]
index = j
end
end
-- flip arrays
tempo = array[i]
array[i] = array[index]
array[index] = tempo
end