diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2022-03-02 20:45:04 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2022-03-12 16:00:38 +0100 |
commit | 197a7a01e458255a578c99c7f477dd0bec7e3a47 (patch) | |
tree | 252e3b3aac3dc46dfc584f003b14e869053e5e28 /doc/it | |
parent | 47e71a1bbd4ff71b8cccd8db4df1187ccf0638f4 (diff) | |
download | weechat-197a7a01e458255a578c99c7f477dd0bec7e3a47.zip |
scripts: allow null values in config_new_option
The plugin API function config_new_option accepts null as the
default_value and/or value however the scripting APIs (except for lua)
didn't allow sending null as a parameter value, so it was impossible to
use it this way. This allows sending a null value for these parameters.
Lua already supported sending in nil for these parameters and it works
as expected, so nothing is changed for this plugin.
For Guile you can now send in #nil, for JavaScript null or undefined,
for Perl undef, for PHP NULL, for Python None, for Ruby nil and for Tcl
$::weechat::WEECHAT_NULL.
In all of these languages except Tcl this is the special value
indicating a missing value. However Tcl only has one type, string, so it
doesn't have a null value. Therefore I created a constant with the value
`\uFFFF\uFFFF\uFFFFWEECHAT_NULL\uFFFF\uFFFF\uFFFF` which is used
instead. This is very unlikely to appear unintentionally. Using the
unicode code point \uFFFF was suggested on
https://wiki.tcl-lang.org/page/null.
I tested this with these scripts:
https://gist.github.com/trygveaa/f91977dde5d2876d502bf55fbf9b50cc
Diffstat (limited to 'doc/it')
0 files changed, 0 insertions, 0 deletions