Jump to content

attempt to compare two table values


Sasu

Recommended Posts

Server:

function getPlayerKillsInOrder() 
    theTable = {} 
    for i, acc in ipairs(getAccounts()) do 
        local name = getAccountName(acc) 
        local kills = getAccountData(acc, "kills") or 0 
  
        table.insert(theTable, {kills, name}) 
    end 
    table.sort(theTable) 
    return theTable 
end 
  
addEvent("refreshList", true) 
addEventHandler("refreshList", root, 
function() 
    triggerClientEvent(source, "onRequestRefresh", source, getPlayerKillsInOrder()) 
    theTable = nil 
end) 

Client:

addEvent("onRequestRefresh", true) 
addEventHandler("onRequestRefresh", root, 
function(theTable) 
    guiGridListClear(GUIEditor.gridlist[1]) 
    for i, v in ipairs(theTable) do 
        local row = guiGridListAddRow(GUIEditor.gridlist[1]) 
        guiGridListSetItemText(GUIEditor.gridlist[1], row, 1, tostring(i), false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[1], row, 2, tostring(v[2]), false, false) 
        guiGridListSetItemText(GUIEditor.gridlist[1], row, 3, tostring(v[1]), false, false) 
    end 
end) 
  

Why the debugscript says: ERROR: attempt to compare two table values ?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...