lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello

I have a newbie question for which Google didn't really help.

I need to exit a script in case the user forgot to pass a parameter,
and noticed that return works in the "if" block but doesn't when used
in the main loop:

==============
if arg[1] == nil then
	print("Argument missing")

	-- why does this work?
	return
else
	print("OK")
end

print("here")

-- why does "return" not work?
-- " '<eof>' expected near '=' "
-- return
if true then return end

print("after return")
==============

Why is that?

Thank  you for your help.