summaryrefslogtreecommitdiff
path: root/doc/en/weechat_plugin_api.en.adoc
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-08-29 10:22:17 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-08-29 10:22:17 +0200
commit8b3311860b0825008e4d2c4bddc3978128d4cb13 (patch)
treed3664eb7aaa56ac31ad6c482498c84c718145b71 /doc/en/weechat_plugin_api.en.adoc
parent58d61cb153761979e162cd80162bac941797c40e (diff)
downloadweechat-8b3311860b0825008e4d2c4bddc3978128d4cb13.zip
api: add support of path to variable and hashtable comparison in function hdata_compare (closes #1066)
Diffstat (limited to 'doc/en/weechat_plugin_api.en.adoc')
-rw-r--r--doc/en/weechat_plugin_api.en.adoc16
1 files changed, 11 insertions, 5 deletions
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc
index fc933adc7..5ea06d649 100644
--- a/doc/en/weechat_plugin_api.en.adoc
+++ b/doc/en/weechat_plugin_api.en.adoc
@@ -18589,7 +18589,7 @@ for key in hash:
==== hdata_compare
-_WeeChat ≥ 1.9._
+_WeeChat ≥ 1.9, updated in 4.1.0._
Compare a hdata variable of two objects.
@@ -18605,8 +18605,8 @@ Arguments:
* _hdata_: hdata pointer
* _pointer1_: pointer to first WeeChat/plugin object
* _pointer2_: pointer to second WeeChat/plugin object
-* _name_: variable name; for arrays, the name can be "N|name" where N is
- the index in array (starting at 0), for example: "2|name"
+* _name_: variable name or path to a variable name; for arrays, the name can be
+ "N|name" where N is the index in array (starting at 0), for example: "2|name"
* _case_sensitive_: 1 for case sensitive comparison of strings, otherwise 0
Return value:
@@ -18622,8 +18622,12 @@ C example:
struct t_hdata *hdata = weechat_hdata_get ("buffer");
struct t_gui_buffer *buffer1 = weechat_buffer_search ("irc", "libera.#weechat");
struct t_gui_buffer *buffer2 = weechat_buffer_search ("irc", "libera.#weechat-fr");
-weechat_printf (NULL, "number comparison = %d",
+weechat_printf (NULL, "comparison of buffer number = %d",
weechat_hdata_compare (hdata, buffer1, buffer2, "number", 0));
+weechat_printf (NULL, "comparison of number of lines = %d",
+ weechat_hdata_compare (hdata, buffer1, buffer2, "own_lines.lines_count", 0));
+weechat_printf (NULL, "comparison of local variable = %d",
+ weechat_hdata_compare (hdata, buffer1, buffer2, "local_variables.myvar", 0));
----
Script (Python):
@@ -18637,7 +18641,9 @@ def hdata_compare(hdata: str, pointer1: str, pointer2: str, name: str, case_sens
hdata = weechat.hdata_get("buffer")
buffer1 = weechat.buffer_search("irc", "libera.#weechat")
buffer2 = weechat.buffer_search("irc", "libera.#weechat-fr")
-weechat.prnt("", "number comparison = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
+weechat.prnt("", "comparison of buffer number = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "number", 0))
+weechat.prnt("", "comparison of number of lines = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "own_lines.lines_count", 0))
+weechat.prnt("", "comparison of local variable = %d" % weechat.hdata_compare(hdata, buffer1, buffer2, "local_variables.myvar", 0))
----
==== hdata_set