Austrothalik Posted February 28, 2021 Posted February 28, 2021 i`m having some difficult do that, right now im haiving this error ERROR: blips/blips.lua:60: attempt to concatenate local 'v' (a table value) what im trying to do: function listTable(queryHandle) local db = dbConnect("sqlite","blips.db") local p = dbPoll(dbQuery(db, "SELECT id,icon,name FROM tabelaBlips"), -1); if (#p > 0) then for k,v in pairs(p) do outputChatBox(k.." = "..v); end end end addCommandHandler("listTable",listTable,false,false) can sameone help me?
Discord Moderators Zango Posted February 28, 2021 Discord Moderators Posted February 28, 2021 It's because you are trying to turn table 'v' into a string. As you can find on the wiki for dbPoll, in your case 'p' will be like this { { colname1=value1, colname2=value2, ... }, { colname1=value3, colname2=value4, ... }, ... } So you need to refer to the column name first outputChatBox(k.." = "..v.id); For your purpose, I suggest using inspect instead which converts a table to a readable string. function listTable(queryHandle) local db = dbConnect("sqlite","blips.db") local p = dbPoll(dbQuery(db, "SELECT id,icon,name FROM tabelaBlips"), -1); if (#p > 0) then outputChatBox(inspect(p)) end end addCommandHandler("listTable",listTable,false,false)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now