WSLUA_METAMETHOD Column__tostring(lua_State *L) { Column c = checkColumn(L,1); const gchar* name; if (!(c)) { return 0; } /* XXX: should return the column's text ! */ name = col_id_to_name(c->col); lua_pushstring(L,name ? name : "Unknown Column"); WSLUA_RETURN(1); /* A string representing the column */ }
WSLUA_METAMETHOD Column__tostring(lua_State *L) { Column c = checkColumn(L,1); const gchar* text; if (!c->cinfo) { text = col_id_to_name(c->col); lua_pushfstring(L, "(%s)", text ? text : "unknown"); } else { text = col_get_text(c->cinfo, c->col); lua_pushstring(L, text ? text : "(nil)"); } WSLUA_RETURN(1); /* The column's string text (in parenthesis if not available). */ }