tools/migration/prosody-migrator.lua
changeset 7897 217412da818f
parent 7896 432f721b0fdf
child 7898 1e1c18012048
--- a/tools/migration/prosody-migrator.lua	Wed Feb 15 15:29:37 2017 +0100
+++ b/tools/migration/prosody-migrator.lua	Wed Feb 15 15:30:19 2017 +0100
@@ -16,19 +16,18 @@
 
 -- Command-line parsing
 local options = {};
-local handled_opts = 0;
-for i = 1, #arg do
+local i = 1;
+while arg[i] do
 	if arg[i]:sub(1,2) == "--" then
 		local opt, val = arg[i]:match("([%w-]+)=?(.*)");
 		if opt then
 			options[(opt:sub(3):gsub("%-", "_"))] = #val > 0 and val or true;
 		end
-		handled_opts = i;
+		table.remove(arg, i);
 	else
-		break;
+		i = i + 1;
 	end
 end
-table.remove(arg, handled_opts);
 
 if CFG_SOURCEDIR then
 	package.path = CFG_SOURCEDIR.."/?.lua;"..package.path;