//响应按键

import console;
console.log("按ESC退出")

while(true){ 
	if( console.kbHit() ){
		var kb = console.kbRead();
		if(!kb) continue;
		
		if( kb.wVirtualKeyCode == 0x1B/*_VK_ESC*/ ){
			break;
		}
		else {
			io.print( string.pack( kb.wVirtualKeyCode), kb.bKeyDown? "按下" : "弹起")
		}
		 
	}
}
 
execute("pause") //按任意键继续
io.close();//关闭控制台
