mommytellme Posted June 15, 2015 Share Posted June 15, 2015 Hello! When i type local rank = fromJSON(f.ranks) outputChatBox(rank) where f.ranks is text from database and its equals [{"1":"Szeregowy", "2":"Test"}] it give me a error: bad argument outputChatBox [exepcted string at argument 1 got nil] Why? Link to comment
mommytellme Posted June 15, 2015 Author Share Posted June 15, 2015 This system fractions and is 85 lines, not the entire required. Paste the most important passage: local f = exports.DB2:pobierzWyniki("SELECT * FROM `prs_frakcje` WHERE `id` = "..getElementData(source, "fid")) local u = exports.DB2:pobierzWyniki("SELECT * FROM `prs_frakcje_players` WHERE `uid` = "..getElementData(plr, "auth:id")) setElementData(plr, "f.name", f.nazwa) setElementData(plr, "f.id", f.id) local rank = fromJSON(f.ranks) outputChatBox(#rank) -- !!!! prints 0 Link to comment
Walid Posted June 15, 2015 Share Posted June 15, 2015 try sth like this local check = exports.DB2:pobierzWyniki("SELECT * FROM `prs_frakcje` WHERE `id` = "..getElementData(source, "fid")) if type(check) ~= "table" or #check ~= 0 or check then local rank = fromJSON(check[1]["ranks"]) -- Your code end Link to comment
mommytellme Posted June 15, 2015 Author Share Posted June 15, 2015 Thank you for your help, but I decided to make this system more robust so that I will not be able to use this solution. Link to comment
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