lua-users home
lua-l archive

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


I'm trying to test simple scripts with the 4.0 lua.exe and luac.exe programs
on Windows.  I take a simple script like so:
		i = 0
		if i then
			print(1)
		else
			print(2)
		end

And save it to a text file called LuaTest.txt.

The script file compiles just fine with luac (although I have no clue what
to do with the output file).

If I send the file to lua (lua < luatest.txt), I get a bunch of errors:
> > error: `end' expected;
  last token read: `<eof>' at line 1 in string "if i then"
> 1
> error: <eof> expected;
  last token read: `else' at line 1 in string "else"
> 2
> error: <eof> expected;
  last token read: `end' at line 1 in string "end"

What gives?  How can I test the script and see the output without putting
all of my if statements on a single line?

Thanks,
Dan