11-26-2014, 04:27 AM
Ok, still doing this, but i ran into an issue.
I want to do a sqlite query to get a list of tables. But somehow i am not able to return the query result.
The query function gets the playername as argument and should return a table of tables (a_List):
This is a sample result which should go into the table:
I would expect something like:
But maybe there is a better way?! I tried several things already, but didnt get it yet. Returning a single result is easy.
Any help would be nice
I want to do a sqlite query to get a list of tables. But somehow i am not able to return the query result.
The query function gets the playername as argument and should return a table of tables (a_List):
function cStorage:GetList( player ) local a_List = {} -- get data from query function getResult(udata, cols, values, names) for i=1,cols do print('',names[i],values[i]) end return 0 end -- get all player homes local sql = "SELECT * FROM " .. PluginName .. " WHERE Player='" .. player .. "'" self:DBExec(sql, getResult) return a_List end
This is a sample result which should go into the table:
ID 1 Player no_use_for_name Name default World world X -68.877814274714 Y 64 Z 205.5105932393 ID 2 Player no_use_for_name Name hill World world X -66.54712734459 Y 64 Z 209.61457523444 ID 3 Player no_use_for_name Name hil World world X -66.54712734459 Y 64 Z 209.61457523444
I would expect something like:
a_List = {{row1,...}, {row2,...}...}
But maybe there is a better way?! I tried several things already, but didnt get it yet. Returning a single result is easy.
Any help would be nice