Skip to content

Commit

Permalink
Removed comment removal logic from remote commands to limit code modi…
Browse files Browse the repository at this point in the history
…fications (#53).

The removed code would remove comments from the code fragment executed
by EXEC command (as this is a single line command), but the removal was
affecting the string content. This modification still affects the
strings, but to a lesser degree.

See the discussion in #53 for alternative approaches.
  • Loading branch information
pkulchenko committed Jun 17, 2021
1 parent f04b1a3 commit a9878e0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/mobdebug.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ end)("os")

local mobdebug = {
_NAME = "mobdebug",
_VERSION = "0.7092",
_VERSION = "0.7093",
_COPYRIGHT = "Paul Kulchenko",
_DESCRIPTION = "Mobile Remote Debugger for the Lua programming language",
port = os and os.getenv and tonumber((os.getenv("MOBDEBUG_PORT"))) or 8172,
Expand Down Expand Up @@ -1378,9 +1378,7 @@ local function handle(params, client, options)
local _, _, exp = string.find(params, "^[a-z]+%s+(.+)$")
if exp or (command == "reload") then
if command == "eval" or command == "exec" then
exp = (exp:gsub("%-%-%[(=*)%[.-%]%1%]", "") -- remove comments
:gsub("%-%-.-\n", " ") -- remove line comments
:gsub("\n", " ")) -- convert new lines
exp = exp:gsub("\n", "\r") -- convert new lines, so the fragment can be passed as one line
if command == "eval" then exp = "return " .. exp end
client:send("EXEC " .. exp .. "\n")
elseif command == "reload" then
Expand Down

0 comments on commit a9878e0

Please sign in to comment.