Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Luaµ÷ÓÃCº¯Êý

¸ù¾Ý¡¶programming in lua¡·µÚ26ÕµÄÄÚÈÝ£¬ÎÒ×ö³öÀ´µÄÈçÏ£º
 
 
1.
Ê×ÏÈ£¬ÎÒµÄLuaĿ¼Ϊ£ºD:\lua5.1\
»·¾³Îª windows ; VC++express edition 2008 ; Lua5.1.4 ; Notepad++
 
µ±È»£¬ÄãÐèÒªÔÚVC++2008ÖÐÅäÖúÃlua£º
 
 
 
ÕâÀïÏȲ»¶à×ö½âÊÍ£¬¼ÙÉèÄãÒѾ­ÅäÖúÃÁË¡£
 
2.
 
ÕÒµ½ D:\lua5.1\src
 
 
 
Ŀ¼Ï嵀 lua.c Îļþ£¬
 
 
 
½«Õâ¶Î´úÂë·Åµ½ lua.c ÎļþÖУ¬Õâ¾ÍÊÇÎÒÃÇ×Ô¼º¶¨ÒåµÄCº¯Êý£º
 
 
 
static int linjunjie (lua_State *L) {
 printf("hello junjie /n");
  return 1;  /* number of results */
}
 
ÕâÀÎÒÃÇÖ»ÊǼòµ¥´òÓ¡Ò»ÐÐÎÄ×Ö£¬Ã»ÓвÎÊý£¬Ã»Óзµ»ØÖµ¡£
 
È»ºó£¬ÎÒÃÇ»¹ÐèÒªÔÚ lua.c ÖÐµÄ main º¯ÊýÖÐÌí¼ÓÎÒÃǵÄ×Ô¶¨Ò庯Êý£¨Ò²¿ÉÒÔ³Æ֮Ϊ“×¢²á”£©£¬Ìí¼ÓÍêÖ®ºó£¬ÀàËÆÏÂÃæÕâÑù£¨ºìÉ«²¿·ÖΪÎÒÃÇÌí¼Ó²¿·Ö£©£º
 
 
 
int main (int argc, char **argv) {
  int status;
  struct Smain s;
  lua_State *L = lua_open();  /* create state */ 
 
 lua_pushcfunction(L, linjunjie);
 lua_setglobal(L, "linjunjie");
 
  if (L == NULL) {
    l_message(argv[0], "cannot create state: not enough memory");
    return EXIT_FAILURE;
  }
  s.argc = argc;
  s.argv = argv;
  status = lua_cpcall(L, &pmain, &s);
  report(L, status);
  lua_close(L);
  return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS;
}
 
3.
ÏÖÔÚ´úÂëÐÞ¸ÄÍê±Ï£¬ÎÒÃÇÐèÒªÖØбàÒëÎÒÃÇµÄ lua £¬·½·¨Îª
½øÈëVS2008µÄÃüÁîÌáʾ£¬È»ºóÖ´ÐÐÈçϲÙ×÷£º
£¨µ½lua5.1Ŀ¼Ï£¬Ö´ÐÐetcĿ¼ÏµÄluavs.batÅú´¦Àí£¬Ëû½«ÌæÎÒÃDZàÒëlua£©
D:\lua5.1>d:\lua5.1\etc\luavs.bat
 
 
 
4.
¼ÙÉèµÚ3²¿Ã»ÓдíÎó£¬Ë³Àû±àÒëÍê³ÉÖ®ºó£¬ÕâʱÎÒÃǵÄ×Ô¶¨Ò庯Êý¾ÍÒѾ­±»×¢²áµ½ÎÒÃÇ»úÆ÷ÖеÄluaÖÐÁË£¬ÊÔһϡ£
 
ÔÚVC++2008ÖУ¬½«luaÌí¼ÓΪÍⲿ¹¤¾ß¡£
 
 
 
È»ºóн¨Ò»¸öwin32¿ØÖÆ̨ӦÓóÌÐò¹¤³Ì£¬Ö®ºó£¬½¨Á¢Ò»¸öÎı¾Îļþ£¬½«
 
linjunjie()
 
¿½±´½øÈ¥£


Ïà¹ØÎĵµ£º

£¨c primer plusµÚÎå°æ£©Ñ§Ï°±Ê¼Ç

 
 
µÚÒ»Õ¸ÅÀÀ
CÊÇÒ»ÖÖ±àÒëÐ͵ÄÓïÑÔ
±àÒëÐÍ£º¾ÍÊÇ°ÑcÓïÑÔ±àÒë³É¼ÆËã»úÄÜÔËÐеĻúÆ÷´úÂë
²»Í¬µÄ¼ÆËã»úϵͳÓÐן÷×ԵıàÒëÆ÷£¬À´°Ñc±àÒë³É¶ÔÓ¦µÄ»úÆ÷´úÂë
ÌØÐÔ£º´úÂë¸ßЧ£¬¿ÉÒÆÖ²£¬¹¦ÄÜÇ¿´óºÍÁé»î
ȱµã£º´úÂë¸ñʽ×ÔÓÉ£¨ÌرðÊÇÖ¸ÕëµÄʹÓã©
 
CÓïÑÔÔËÐеÄÆ߸ö²½Ö裺
1.     ¶¨Ò ......

cÖкÍjavaÖÐÊý×éµÄÇø±ð

  ¶ÔÓÚÔ­ÓïÀàÐ͵ÄÊý×飬Èçint[]   a,ÔÚCÀïÃæÖ»ÒªÕâÑù¶¨ÒåÖ®ºó¾Í¿ÉÒÔÓÃa[i]ʹÓÃÁË£¬µ«ÊÇÔÚJAVAÀïÃæÊDz»Ðеģ¬±ØÐëÓÃint[]   a   =   new   int[LENGTH];À´ÎªÊý×é·ÖÅä¿Õ¼ä¡£ÕâÀïµÄa¸üÓ¦¸Ã¿´³ÉCÀïÃæµÄÖ¸Õ룬ËüºÍCÀïÃæµÄint*   aÊÇÒ»ÑùµÄ£¬ÒòΪÕâ¸öa£¨CÀïÃæµÄ£©Ò²ÒªÏÈmallocÒ»¸ö¿Õ¼äÖ®ºó²Å¿ ......

C/C++Ô¤´¦Àí ISO/ANSI C±ê×¼ÒëÎÄÓë×¢½â

C/C++Ô¤´¦Àí ISO/ANSI C±ê×¼ÒëÎÄÓë×¢½â
http://blog.csdn.net/huyansoft/archive/2008/05/26/2484297.aspx
<<ISO/ANSI C±ê×¼ÒëÎÄÓë×¢½â C/C++Ô¤´¦Àí²¿·Ö>>
ÄÚÈݼò½é£º±¾ÎĵµÍêÕû·­ÒëÁËC±ê×¼(99°æ)ÖÐÔ¤´¦ÀíºÍÏà¹ØÕ½ڵÄÄÚÈÝ£¬²¢ÔÚÐí¶à±ØÒªÖ®´¦¸½¼ÓÁË×¢½âºÍ³ÌÐòʾÀý£¬ÒÔ°ïÖú¶ÁÕßÀí½â±ê×¼Ô­ÎÄ£¬Í¬Ê±ÖÆ×÷ÁËÏêϸµ ......

×Ô¼ºÐ´µÄC/C++±àÒëÆ÷Doctors[Èí¼þ+Îĵµ]

¸üа汾1.0.1£º¸Ã°æ±¾½â¾öÁË֮ǰ1.0.0°æ±¾ÖÐÕÒ²»µ½Á´½Ó¿âlibc.libµÄÎÊÌ⣬ÒÔ¼°IDEϵã»÷Project²Ëµ¥³öÏÖµÄBUG¡£ÏÂÔصØÖ·£ºhttp://download.csdn.net/source/1597132
 
Doctors±àÒëÆ÷ÄÚ²¿ÊµÏÖ
For version 1.0.1
³ö´¦£ºhttp://blog.csdn.net/huyansoft
×÷ÕߣººúÑå
Copyright(c) 2009£¬All Rights Reserved
&nbs ......

CÀàÐÍת»»


Ç¿ÖÆÀàÐÍת»»ÊÇͨ¹ýÀàÐÍת»»ÔËËãÀ´ÊµÏֵġ£ÆäÒ»°ãÐÎʽΪ£º (ÀàÐÍ˵Ã÷·û) (±í´ïʽ) Æ书ÄÜÊǰѱí´ïʽµÄÔËËã½á¹ûÇ¿ÖÆת»»³ÉÀàÐÍ˵Ã÷·ûËù±íʾµÄÀàÐÍ¡£ÀýÈ磺 (float) a °Ñaת»»ÎªÊµÐÍ(int)(x+y) °Ñx+yµÄ½á¹ûת»»ÎªÕûÐÍÔÚʹÓÃÇ¿ÖÆת»»Ê±Ó¦×¢ÒâÒÔÏÂÎÊÌ⣺
1.ÀàÐÍ˵Ã÷·ûºÍ±í´ïʽ¶¼±ØÐë¼ÓÀ¨ºÅ(µ¥¸ö±äÁ¿¿ÉÒÔ²»¼ÓÀ¨ºÅ)£¬Èç°Ñ(int) ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ