[תÔØ] Lua ÖÐÓë C ²»Í¬µÄÉè¼Æ
¾¡¹Ü Lua µÄ¹Ø¼ü´ÊµÄÉè¼Æ£¬ÔËÐзûµÄÉè¼Æ£¬Óï·¨µÄÉè¼ÆµÈ·½ÃæÓë C ºÜÏàËÆ£¬µ«ÎÒÃÇ»¹Òª×¢ÒâÆäÃ÷ÏÔ²»Í¬µÄµØ·½¡£
Ìõ¼þÅжÏʱµÄÕæ¼ÙÌõ¼þ
Lua ÖÐËùÓеÄÖµ¶¼¿ÉÒÔ×÷ΪÌõ¼þ¡£ÔÚ¿ØÖƽṹµÄÌõ¼þÖгýÁË false ºÍ nil Ϊ¼Ù£¬ÆäËûÖµ¶¼ÎªÕæ¡£ËùÒÔ Lua ÈÏΪ 0 ºÍ ¿Õ´® ¶¼ÊÇÕæ¡£
¶ø C ÖУ¬ÈÏΪֻҪÊÇÔÚÄÚ´æÖбíÏÖΪ 0 ÖµµÄ·ûºÅ¶¼Îª¼Ù¡£
×Ö·û´®
Lua ÖÐ×Ö·û´®µÄ¶¨ÒåÊÇ ×Ö·ûµÄÐòÁС£lua µÄ×Ö·û´®¿ÉÒÔ°üº¬ÈκÎÊýÖµ×Ö·û£¬°üÀ¨Ç¶ÈëµÄ 0¡£ÕâÒâζ×ÅÄã¿ÉÒÔ´æ´¢ÈÎÒâµÄ¶þ½øÖÆÊý¾ÝÔÚÒ»¸ö×Ö·û´®Àï¡£Lua ±¾ÉíÓÐÏàÓ¦µÄº¯ÊýÀ´´¦ÀíÕâÑùµÄ×Ö·û´®¡£
¶ø C ÓïÑÔÖУ¬ËäȻҲ¿ÉÒÔÔÚÒ»¸ö×Ö·û´®Öдæ·Å 0£¬µ«Æä×Ö·û´®´¦Àíº¯Êý²»ÄÜÕýÈ·´¦Àí·ÅÔÚÖмäµÄÁãÖµ£¬ÒòΪ C ÖеÄËã·¨²»ÊÇÓó¤¶ÈÀ´×öÅжϣ¬¶øÊÇÒÔÓöµ½µÚÒ»¸öÁãÖµÀ´Åжϵġ£
תÒå×Ö·û:
\a bell \b back space -- ºóÍË
\f form feed -- »»Ò³ \n newline -- »»ÐÐ
\r carriage return -- »Ø³µ \t horizontal tab -- ÖƱí
\v vertical tab \\ backslash -- "\"
\" double quote -- Ë«ÒýºÅ \' single quote -- µ¥ÒýºÅ
\[ left square bracket -- ×óÖÐÀ¨ºÅ \] right square bracket -- ÓÒÖÐÀ¨ºÅ
»¹¿ÉÒÔÓÃ[[…]]±íʾ×Ö·û´®,ÕâÖÖÐÎʽµÄ×Ö·û´®¿ÉÒÔ°üº¬¶àÐпÉÒÔǶÌ×ÇÒ²»»á½âÊÍתÒåÐòÁС£
ÔËÐÐʱ£¬Lua»á×Ô¶¯ÔÚstringºÍnumberÖ®¼ä×Ô¶¯½øÐÐÀàÐÍת»»¡£
¹ØϵÔËËã·û
Lua ÖеIJ»µÈºÅÊÇ ~=£¬
¶ø C ÖеIJ»µÈºÅÊÇ !=¡£
Âß¼ÔËËã·û
Lua ÖеÄÂß¼ÔËËã·ûÊÇ and, or, not£¬¶ø C ÖеÄÂß¼ÔËËã·ûÊÇ &&, ||, !¡£¶øÇÒËüÃǵÄÓ÷¨ºÜ´óµÄ²»Ò»Ñù£¬Lua µÄÂß¼ÔËËã·ûµÄÓ÷¨ÏÔµÃÓеã“С¼¼ÇÉ”¡£
Lua Âß¼ÔËËã·ûÈÏΪ false ºÍ nil ÊǼ٣¨false£©£¬ÆäËûΪÕ棬0Ò²ÊÇtrue¡£
and ºÍ or µÄÔËËã½á¹û²»ÊÇ true ºÍ false£¬¶øÊǺÍËüµÄÁ½¸ö²Ù×÷ÊýÏà¹Ø¡£
not µÄ½á¹ûÒ»Ö±·µ»Ø false »òÕß true¡£
a and b -- Èç¹ûaΪfalse£¬Ôò·µ»Øa£¬·ñÔò·µ»Øb
a or b -- Èç¹ûaΪtrue£¬Ôò·µ»Øa£¬·ñÔò
Ïà¹ØÎĵµ£º
Ê×ÏÈ¿´ÏÂÏÂÃæÕâ¶Î£º
int main()
{
char *name = "fengkewei";
char name1[] = "fengkewei";
char *name2 = "fengkewei";
char *name3 = "woaifengkewei";
int i = 10;
int j = 10;
int k = 11;
return 0;
}
ÈôÄú¾õµÃËüÃÇÓ¦¸Ã¶¼±£´æÔÚÄÚ´æÖеÄÒ»¿éµØ·½£¬ÄÇÇëÍùÏ¿´¡£¡£¡£¡£
ÏÂÃæÊDZàÒëÆ÷Ϊ¸÷¸ö±äÁ¿·ÖÅäµÄÄÚ´æµØ ......
ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book>
<name>¹þÀï²¨Ì ......
C/SÓÖ³ÆClient/Server»ò¿Í»§/·þÎñÆ÷ģʽ¡£·þÎñÆ÷ͨ³£²ÉÓøßÐÔÄܵÄPC¡¢¹¤×÷Õ¾»òСÐÍ»ú£¬²¢²ÉÓôóÐÍÊý¾Ý¿âϵͳ£¬ÈçOracle¡¢Sybase¡¢Informix»ò SQL Server¡£¿Í»§¶ËÐèÒª°²×°×¨ÓõĿͻ§¶ËÈí¼þ¡£
¡¡¡¡B/£ÓÊÇBrower/ServerµÄËõд£¬¿Í»§»úÉÏÖ»Òª°²×°Ò»¸öä¯ÀÀÆ÷£¨Browser£©£¬ÈçNetscape Navigator»òInternet Explorer£¬·þÎñÆ÷°²×°O ......
ÔÚ±à³ÌµÄ¹ý³ÌÖУ¬ÎļþµÄ²Ù×÷ÊÇÒ»¸ö¾³£Óõ½µÄÎÊÌ⣬ÔÚC++BuilderÖУ¬¿ÉÒÔʹÓöàÖÖ·½·¨¶ÔÎļþ²Ù×÷£¬ÏÂÃæÎҾͰ´ÒÔϼ¸¸ö²¿·Ö¶Ô´Ë×÷Ïêϸ½éÉÜ£¬¾ÍÊÇ£º
1¡¢»ùÓÚCµÄÎļþ²Ù×÷£»
2¡¢»ùÓÚC++µÄÎļþ²Ù×÷£»
3¡¢»ùÓÚWINAPIµÄÎļþ²Ù×÷£»
4¡¢»ùÓÚBCB¿âµÄÎļþ²Ù×÷£»
5¡¢ÌØÊâÎļþµÄ²Ù×÷¡£
¡¡
Ò¼¡¢»ùÓÚCµÄÎļþ²Ù×÷
¡¡¡¡ÔÚANSI CÖУ¬ ......