-
-
Notifications
You must be signed in to change notification settings - Fork 437
lua: Fixes and improvements #1520
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@kannibalox, review, please. |
@rakshasa, could you please review. |
I'll review it later. |
I thought in the last PR (#1260) it wasn't very clear how to try the new functionality and added a example config |
Checked the build with Lua in Manjaro and Nixos. Change of package for Nixos: {
configureflags = [
"--with-lua"
];
nativeBuildInputs = [
lua5_4_compat
];
buildInputs = [
lua5_4_compat
];
} Changes for Manjaro's PKGBUILD: deps = (lua)
makedeps = (LUA)
./configure --with-lua Perhaps |
@rakshasa, is there anything that I should add so that it is easier for you to test this branch? |
I'm just in the middle of some complicated tracker/http/dht threading work so don't have the bandwidth to figure out LUA atm. The review will be done, but it might be a couple weeks at least. |
- missing `pos = end + 1` pos caused infinite loop - there was no processing of the last element after the last ';', i.e. it was assumed that `lua_path` always has ';' in the last character
rtorrent doesn't have floating point data type
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`.
…tocall 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.
Updated @kannibalox's method to pass lua-functions as rtorrent's methods.
Additional step to test in development (non-packaged) mode: - In packaged mode, rtorrent knows where to search rtorrent.lua, but in project mode, rtorrent.lua located in a non-standard location. Therefore run rtorrent with following environment variabler set: LUA_PATH=<full path to rtorrent project dir>/lua/?.lua
Rebased. |
Looks like using config.h is not solvable, so let's just use |
Or rather, have a define in config.h: And pass PACKAGE_DATADIR using CPPFLAGS, as this allows the user to override the lua directory. |
|
No, that misses the purpose. It's supposed to be changeable by the user when compiling, and as such belongs in config.h. Preferably it should be exposed as an option to configure, however that isn't necessary to add atm. |
scripts/checks.m4
Outdated
@@ -284,6 +284,7 @@ AC_DEFUN([TORRENT_WITH_LUA], [ | |||
AX_LUA_LIBS | |||
AX_LUA_HEADERS | |||
AC_DEFINE(HAVE_LUA, 1, Use LUA.) | |||
AC_DEFINE_UNQUOTED(LUA_DATADIR, ["${prefix}/share/rtorrent/lua"], Use LUA.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be AC_DEFINE(LUA_DATADIR, [PACKAGE_DATADIR "/lua"], [LUA data directory])
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Is there anything that needs to be finished? |
Ping |
@rakshasa , Is there anything that needs to be finished? |
I'll have to test it first, so should get a proper review done soon. |
Description
rtorrent.lua
to rtorrent's distributionrtorrent.lua
autocall_config
with global environment_G
removedd.*
,f.*
,p.*
,t.*
,load.*
commandsinsert_lua_method()
to insert lua functions as rtorrent's methodsprint=
shadowed by native Luaprint()