diff -r 999ef93f0dbc -r 03ed0ca09837 dbd/sqlite3/connection.c --- a/dbd/sqlite3/connection.c Sat Jun 13 08:55:44 2009 +0000 +++ b/dbd/sqlite3/connection.c Tue Sep 01 13:15:02 2009 +0000 @@ -198,6 +198,17 @@ return 0; } +/* + * __tostring + */ +static int connection_tostring(lua_State *L) { + connection_t *conn = (connection_t *)luaL_checkudata(L, 1, DBD_SQLITE_CONNECTION); + + lua_pushfstring(L, "%s: %p", DBD_SQLITE_CONNECTION, conn); + + return 1; +} + int dbd_sqlite3_connection(lua_State *L) { /* * instance methods @@ -229,6 +240,9 @@ lua_pushcfunction(L, connection_gc); lua_setfield(L, -2, "__gc"); + lua_pushcfunction(L, connection_tostring); + lua_setfield(L, -2, "__tostring"); + luaL_register(L, DBD_SQLITE_CONNECTION, connection_class_methods); return 1;