don't tolerate Lua comments when parsing commands

We only care about Lua comments when the message doesn't start with a
command.
This commit is contained in:
Kartik K. Agaram 2023-07-24 00:11:33 -07:00
parent 6679c6e545
commit d16eba699f
1 changed files with 6 additions and 1 deletions

View File

@ -196,7 +196,8 @@ function live.run(buf)
live.send_to_driver(contents)
-- other commands go here
else
local definition_name = cmd
local definition_name = live.get_definition_name_from_buffer(buf)
print('definition name is '..definition_name)
if Live.frozen_definitions[definition_name] then
live.send_to_driver('ERROR definition '..definition_name..' is part of Freewheeling infrastructure and cannot be safely edited live.')
return
@ -224,6 +225,10 @@ function live.run(buf)
end
function live.get_cmd_from_buffer(buf)
return buf:match('^%s*(%S+)')
end
function live.get_definition_name_from_buffer(buf)
return buf:gsub('%-%-[^\n]*', ''):match('^%s*(%S+)')
end