doc(lua): More examples for insert_lua_method

This commit is contained in:
PRESFIL
2025-08-26 17:38:57 +00:00
committed by Jari Sundell
parent 1039497a1a
commit 4a5bc86643
+33 -9
View File
@@ -63,15 +63,39 @@ end
-- Allow insert global lua-finction `func_name` at rtorrent slot `name` -- Allow insert global lua-finction `func_name` at rtorrent slot `name`
-- @param name string rtorrent's slot -- @param name string rtorrent's slot
-- @param func_name string name of global lua-function -- @param func_name string name of global lua-function
-- @param ... list of rtorrent's arguments like `(d.name)` to be -- @param method_args number|string[]|number[]
-- passed to lua-function when it be called by rtorrent -- rtorrent's arguments like `(d.name)` to be passed to lua-function when it be
-- 1) non-negative integer - number of first arguments -- called by rtorrent:
-- 2) table (array) of strings - concrete rtorrent strings, --
-- passed in specified order -- 1) non-negative integer - number of first arguments to be passed
-- 3) table (array) of non-negative integer - indexes, converted --
-- to $argument.0, $argument.1 ..., passed in specified order -- example:
-- NOTE: first argement of func_name is always target, -- rtorrent.insert_lua_method('d.watch_handler', 'watch_handler', 1)
-- may be empty string --
-- gives following rtorrent event handler:
-- d.watch_handler=$argument.0
--
-- 2) table (array) of strings - concrete rtorrent strings, passed in specified
-- order
--
-- example:
-- rtorrent.insert_lua_method('d.watch_handler', 'watch_handler', { '$argument.0=' })
--
-- gives following rtorrent event handler:
-- d.watch_handler=$argument.0
--
-- 3) table (array) of non-negative integer - indexes, converted to
-- $argument.0, $argument.1 ..., passed in specified order
--
-- example:
-- rtorrent.insert_lua_method('d.watch_handler', 'watch_handler', { 1, 0 })
-- or:
-- rtorrent.insert_lua_method('d.watch_handler', 'watch_handler', { [1]=1, [2]=0 })
--
-- gives following rtorrent event handler:
-- d.watch_handler=$argument.1,$argument.0
--
-- NOTE: first argement of func_name is always target, may be empty string
rtorrent["insert_lua_method"] = function (name, func_name, method_args) rtorrent["insert_lua_method"] = function (name, func_name, method_args)
local args = {} local args = {}