kenlistian

厚积薄发. 勤为桨,思为帆

   :: 首页 :: 新随笔 ::  :: 聚合  :: 管理 ::
  73 随笔 :: 4 文章 :: 22 评论 :: 0 Trackbacks
lua是一个脚本语言,可以嵌入到c/c++中,它是世界上最小巧的脚本语言。
学习它可以大大的扩充对数据设置方面的许多要求。
lua,在西班人称之月亮宝石,的确,把它掌握,把它嵌在vc之宝剑剑柄之上,
将让你砍杀一切“拦路之怪兽”增加魔法之光彩!
 
首先,lua可以运行在windows平台,但是你必须下载源码对它编译,下载地址在
http://www.lua.org/
 
如果采用vc6以上的话,编译文件在\LUA\lua-5.1.1\etc中的bat中,
如何构建lua,help有很清楚的解释
* Building Lua on Windows and other systems
  -----------------------------------------
  If you're not using the usual Unix tools, then the instructions for
  building Lua depend on the compiler you use. You'll need to create
  projects (or whatever your compiler uses) for building the library,
  the interpreter, and the compiler, as follows:
  library: lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c
  lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c
  ltable.c ltm.c lundump.c lvm.c lzio.c
  lauxlib.c lbaselib.c ldblib.c liolib.c lmathlib.c loslib.c
  ltablib.c lstrlib.c loadlib.c linit.c
  interpreter: library, lua.c
  compiler: library, luac.c print.c
  If you use Visual Studio .NET, you can use etc/luavs.bat
  in its "Command Prompt".
 
 If all you want is to build the Lua interpreter, you may put all .c files
  in a single project, except for luac.c and print.c. Or just use etc/all.c.
  To use Lua as a library in your own programs, you'll need to know how to
  create and use libraries with your compiler.
  As mentioned above, you may edit luaconf.h to select some features before
  building Lua.
 
在vc中做,很简单,如果想静态的,先生成一个空静态工程文件,加入以上文件,就建出library。lib文件,如果想生成动态的,则建一个动态工程文件,加入以上文件,就建成library。dll和library。lib文件。
 
如果要建一个一个编译器,则把上面的lib,和lua。c和print。c放在一个新win32控制台工程文件编译,形成了dos界面的exe,在dos下运行,生成的lua.exe如下
http://kk
脚本解释器,就是把lua。c和lib文件放在一个空win32工程文件编辑成luaw.exe
 
写一个简单的“hello world”文件,如下
 print( “hello world”)  保存为hello。lua,
 
在dos下运行huae hello。lua
 将会打印出字符串。
 
好了,第一篇介绍完。
 
 
 
 
 
 
 
 
posted on 2006-06-17 17:53 kenlistian 阅读(332) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理