freudo Posted May 2, 2015 Posted May 2, 2015 This line error;6 for i,v in ipairs(data) do function initSQLTable(tab, data) local ctab = executeSQLQuery("SELECT sql FROM sqlite_master WHERE type='table' AND name=?", tab)[1] if ctab then local qs = {} for i,v in ipairs(data) do local n, t, d = unpack(v) if not string.find(ctab.sql, n) then if t and d then d = "'" .. d .. "'" end local qc = "ALTER TABLE ? ADD COLUMN " .. n .. " " if t then qc = qc .. "TEXT" else qc = qc .. "INTEGER" end if d then qc = qc .. " DEFAULT " .. d .. " NOT NULL" end table.insert(qs, qc) end end for i,v in ipairs(qs) do executeSQLQuery(v, tab) end else local query = "CREATE TABLE IF NOT EXISTS ? (" for i,v in ipairs(data) do local n, t, d = unpack(v) if t and d then d = "'" .. d .. "'" end local qc = n .. " " if t then qc = qc .. "TEXT" else qc = qc .. "INTEGER" end if d then qc = qc .. " DEFAULT " .. d .. " NOT NULL" end if i ~= 1 then qc = ", " .. qc end query = query .. qc end query = query .. " )" executeSQLQuery(query, tab) outputDebugString(query) end end function addSQLRow(tab, data) local rowsstr = "" local valsstr = "" local vals = {} local i = 1 for k,v in pairs(data) do if i ~= 1 then rowsstr = rowsstr .. "," valsstr = valsstr .. "," end rowsstr = rowsstr .. k valsstr = valsstr .. "?" table.insert(vals, v) i = i + 1 end executeSQLQuery("INSERT INTO ? (" .. rowsstr .. ") VALUES (" .. valsstr .. ")", tab, unpack(vals)) end WOC-DD Destruction Derby -Level system -Clan system -Topwins -Event system for EXP -Podium with animation And more
Walid Posted May 2, 2015 Posted May 2, 2015 use /debugscript 3 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
freudo Posted May 2, 2015 Author Posted May 2, 2015 This line error;6for i,v in ipairs(data) do this line error WOC-DD Destruction Derby -Level system -Clan system -Topwins -Event system for EXP -Podium with animation And more
WhoAmI Posted May 2, 2015 Posted May 2, 2015 Tell me how you call the function. What are you giving in 2nd argument.
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