UserToDelete Posted February 12, 2015 Share Posted February 12, 2015 (edited) El problema es que los return de las SQL me dan un return en userdata en vez de darme el valor en si de la tabla en cuestion, Como es la de "Dinero" dejo unn pequeño ejemplo de como es la tabla Cuenta Dinero venadHD 758 venad 1500 Server.lua function saveSystem (source, _) playerAccount = tostring(getAccountName(getPlayerAccount(source))) db = dbConnect("sqlite", "database.db") x = dbQuery(db, 'select "Dinero" from save where cuenta=?;', playerAccount) xs = dbPoll(x,-1) for id, values in ipairs(xs) do outputChatBox(playerAccount.." | "..tostring(xs), source, 255,0,0,true) end end addCommandHandler("dbtt", saveSystem) El return al outputChatBox(), es el siguiente: [2015-02-12 23:22:22] [Output] : venadHD | table: 0xbb80210 No se sacar el valor de la tabla he probado con la variante "values" pero da un userdata igualmente y no un numero Edited February 13, 2015 by Guest Link to comment
Tomas Posted February 13, 2015 Share Posted February 13, 2015 Lo que estás haciendo es pasar a string la tabla, function saveSystem (source, _) playerAccount = tostring(getAccountName(getPlayerAccount(source))) db = dbConnect("sqlite", "database.db") x = dbQuery(db, 'select "Dinero" from save where cuenta=?;', playerAccount) xs = dbPoll(x,-1) for id, values in ipairs(xs) do outputChatBox(playerAccount.." | "..tostring(values.Dinero), source, 255,0,0,true) end end addCommandHandler("dbtt", saveSystem) Link to comment
UserToDelete Posted February 13, 2015 Author Share Posted February 13, 2015 Funciona perfecto Gracias Link to comment
Recommended Posts