9 Commits

Author SHA1 Message Date
PRESFIL 4a5bc86643 doc(lua): More examples for insert_lua_method 2025-08-26 20:11:17 +02:00
PRESFIL 1039497a1a feat(lua): Extend insert_lua_method's func_name's arguments
Allows short form with number of arguments and long flexible form with table:

```lua
rtorrent.insert_lua_method('d.watch_handler', 'watch_handler', { '$argument.0=' })
rtorrent.insert_lua_method('d.watch_handler', 'watch_handler', { 0 })
rtorrent.insert_lua_method('d.watch_handler', 'watch_handler', { [1] = 0 })
rtorrent.insert_lua_method('d.watch_handler', 'watch_handler', 1)
rtorrent.insert_lua_method('d.watch_handler', 'watch_handler', 0)
```

Also, there are way to pass no arguments at all:

```lua
rtorrent.insert_lua_method('d.watch_handler', 'watch_handler')
```

Type checking added.
2025-08-26 20:11:17 +02:00
PRESFIL 36a39e91c8 doc(lua): insert_lua_method: Document, that target always passed 2025-08-26 20:11:17 +02:00
PRESFIL 95cc070ecc feat(lua): Add insert_lua_method for lua-callbacks
Updated @kannibalox's method to pass lua-functions as rtorrent's methods.
2025-08-07 11:03:58 +02:00
PRESFIL d43d08404a feat(lua): Some aliases for Target-commands 2025-08-07 11:03:58 +02:00
PRESFIL c92becbb7c feat(lua): Replace Autocall with Target-object, Autocall_config -> Autocall
Deep-copy `__namestack` decouples all instances of Autocall, previously it
worked as singleton. This allows to store call-chains as variables, aliases.

Target-object allows to avoid duplication of the target-parameter as required
with Autocall by storing them as variables.

Autocall_config renamed to Autocall for brevity.
2025-08-07 11:03:58 +02:00
PRESFIL 20887b1ccb fix(lua): print= shadowed by native Lua print()
Trying `rc.print()` causes redirection to native global Lua `print()`, which
prints to stdout. I don't see any proc of shor-circuiting `autocall_config`
with global environment `_G`.
2025-08-07 11:03:58 +02:00
PRESFIL 3bd111e498 feat(lua): Add autocall_config assignment semantic 2025-08-07 11:03:58 +02:00
PRESFIL f8ec1ca95e fix(lua): Make rtorrent.lua accessible at start 2025-08-07 11:03:58 +02:00