Port works only after opened with PuTTY


Arduino project is enclosed in the box and connected to the PC (Win7 and XP tested). LUA script is supposed to react if Arduino sends string in ASCII.
Strange thing is that I can receive the data only if I open the port in PuTTY before. This needs to be done only once after computer restart, but
is creating trouble to make this service automatic. Any idea what needs to be done to the port (or what PuTTY is doing to the port) to read from
it if Arduino is connected?


serial_port = "com3"
rserial = io.open(serial_port,"r")

while 1 do
	data = rserial:read("*l")
	if data == "printlabel" then
		io.write("- Received command ... ")
		os.execute [["C:\DPScripts\Printer\p.bat"]]
		rserial = io.open(serial_port,"r")

That doesn't look like Arduino code.

There is nothing in that code that sets the baud rate or any of the other port properties. Perhaps the defaults are not up to the Arduino's standards. Opening Putty first fixes whatever that language/code is not setting correctly would be my guess.