ekoo 8 Posted September 12, 2014 Share Posted September 12, 2014 Hi everybody, I want do function in game source ( mysql query select ) my function int _mysql_query_select( lua_State* L ){ SQLMsg *msg = DBManager::instance().DirectQuery(lua_tostring(L, 1)); if (msg->uiSQLErrno != 0) return 0; MYSQL_RES *res = msg->Get()->pSQLResult; MYSQL_ROW row = mysql_fetch_row(res); if (!row) return 0; lua_pushstring(L, row); return 1; } error questlua_global.cpp: In function 'int quest::_mysql_query_select(lua_State*)': questlua_global.cpp:1207: error: cannot convert 'char**' to 'const char*' for argument '2' to 'void lua_pushstring(lua_State*, const char*)' 1 Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7173 Posted September 12, 2014 Honorable Member Share Posted September 12, 2014 Try mine: http://www.elitepvpers.com/forum/metin2-pserver-guides-strategies/3327940-release-mysql_direct_query-get_table_postfix-mysql_escape_string-written-c-lua.html 1 1 Check out my GitHub Link to comment Share on other sites More sharing options...
Thorer 19 Posted September 12, 2014 Share Posted September 12, 2014 Try mine: http://www.elitepvpers.com/forum/metin2-pserver-guides-strategies/3327940-release-mysql_direct_query-get_table_postfix-mysql_escape_string-written-c-lua.html Is any way to get result from query without loop? Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7173 Posted September 12, 2014 Honorable Member Share Posted September 12, 2014 Try mine: http://www.elitepvpers.com/forum/metin2-pserver-guides-strategies/3327940-release-mysql_direct_query-get_table_postfix-mysql_escape_string-written-c-lua.html Is any way to get result from query without loop?You have to convert the result to something acceptable for lua. Mine does it.If you need something in particular, just write the complete request here. NB: In your code, you're trying to push the list of all the fields of your row as string. (this is clearly not possible using a direct way like yours) Check out my GitHub Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now