allow discarding the return values of instructions

M  faden.lua
M  standardbefehlssatz.lua
M  util/standartbefehlssatz_doc.lua
This commit is contained in:
Hybrid Dog 2017-01-03 14:44:06 +01:00
parent fd15773adb
commit e70f51aa32
3 changed files with 7 additions and 11 deletions

View File

@ -27,20 +27,16 @@ local function befehl_ausfuhren(faden)
if not weiter then
return false, "Command " .. befehl .. ": " .. ergebnis
end
if ergebnis ~= nil then
if args
and ergebnis ~= nil then
if type(ergebnis) ~= "table" then
ergebnis = {ergebnis}
end
for i,v in pairs(ergebnis) do
if not ersetzbar[i] then
-- message sometimes incorrect
return false, "Command " .. befehl .. ": Attempt on changing an immediate"
if args[i]
and ersetzbar[i] then
vars[args[i]] = v
end
if not args[i] then
-- can this happen? Is it a mistake in instruction set? bef ,b,,d
return false, "Command " .. befehl .. ": Missing target argument"
end
vars[args[i]] = v
end
end
faden.ip = faden.ip + 1

View File

@ -237,7 +237,7 @@ s = {
if type(p) ~= "number" then
return false, UAT
end
subsucc,msg = s.usleep({p * 1000000}, faden)
local subsucc,msg = s.usleep({p * 1000000}, faden)
if not subsucc then
return false, SE .. msg
end

View File

@ -62,7 +62,7 @@ o = o .. "\n\nInstructions:\n\n"
for i = 1,#instr do
i = instr[i]
o = o .. i[1] .. " " .. i[2] .. "\n"
.. " " .. i[3] .. "\n\n"
.. " " .. i[3] .. "\n\n" -- TODO: max 80 letters each line
end
print(o)