Fix debug option.

This commit is contained in:
John Livingston 2023-05-21 11:23:57 +02:00
parent 92f076d425
commit ef3417dab0
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
1 changed files with 2 additions and 0 deletions

View File

@ -5,6 +5,7 @@
local what = table.remove(arg, 1); local what = table.remove(arg, 1);
if what == 'debug' then if what == 'debug' then
-- Special debug mode. Should not be used in production. -- Special debug mode. Should not be used in production.
-- Note: i did not achieve to make it properly work (Prosody uses coroutines, and i did not manage to use breakpoints)
print('Activating MobDebug...'); print('Activating MobDebug...');
mobdebug_path = table.remove(arg, 1); mobdebug_path = table.remove(arg, 1);
mobdebug_host = table.remove(arg, 1); mobdebug_host = table.remove(arg, 1);
@ -12,6 +13,7 @@ if what == 'debug' then
local lua_path_sep = package.config:sub(3,3); local lua_path_sep = package.config:sub(3,3);
local dir_sep = package.config:sub(1,1); local dir_sep = package.config:sub(1,1);
package.path = package.path..lua_path_sep..mobdebug_path..dir_sep.."?.lua"; package.path = package.path..lua_path_sep..mobdebug_path..dir_sep.."?.lua";
require "mobdebug".checkcount = 1;
require "mobdebug".start(mobdebug_host, mobdebug_port); require "mobdebug".start(mobdebug_host, mobdebug_port);
require "mobdebug".coro(); require "mobdebug".coro();
what = table.remove(arg, 1); what = table.remove(arg, 1);