mommytellme Posted June 15, 2015 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?
Walid Posted June 15, 2015 Posted June 15, 2015 post full code here. Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
mommytellme Posted June 15, 2015 Author 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
Walid Posted June 15, 2015 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 Do not yield your back to your enemy, might feel something strange in your ass. Two things are infinite the universe and human stupidity and i'm not sure about the universe. UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators
mommytellme Posted June 15, 2015 Author 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.
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