Comparison

plugins/mod_admin_shell.lua @ 13640:c749a751b4a5

mod_admin_shell: Fix help forgetting arguments The array:pluck() method mutates the args, replacing the table items with the resulting strings. On later runs I assume it tries to index the string, which returns nil, emptying the array.
author Kim Alvefur <zash@zash.se>
date Sun, 02 Feb 2025 13:33:17 +0100
parent 13625:ff13dd315e68
child 13641:d980c3e03637
comparison
equal deleted inserted replaced
13639:94f77a1994dc 13640:c749a751b4a5
454 print(""); 454 print("");
455 end 455 end
456 456
457 for command, command_help in it.sorted_pairs(section_help.commands or {}) do 457 for command, command_help in it.sorted_pairs(section_help.commands or {}) do
458 c = c + 1; 458 c = c + 1;
459 local args = command_help.args:pluck("name"):concat(", "); 459 local args = array.pluck(command_help.args, "name"):concat(", ");
460 local desc = command_help.desc or command_help.module and ("Provided by mod_"..command_help.module) or ""; 460 local desc = command_help.desc or command_help.module and ("Provided by mod_"..command_help.module) or "";
461 print(("%s:%s(%s) - %s"):format(section_name, command, args, desc)); 461 print(("%s:%s(%s) - %s"):format(section_name, command, args, desc));
462 end 462 end
463 elseif help_topics[section_name] then 463 elseif help_topics[section_name] then
464 local topic = help_topics[section_name]; 464 local topic = help_topics[section_name];