随笔分类 -  106:lua

(转)Lua与C/C++交互——Lua调用C/C++
摘要:http://blog.csdn.net/zhangyafengcpp/article/details/6848678 阅读全文

posted @ 2013-04-11 10:24 cv_ml_张欣男 阅读(155) 评论(0) 推荐(0)

(转)Lua与C++的逻辑舞步
摘要:以前写过一篇Lua的基础文章,属于基础的技术普及贴,具体请参阅精华区。以下的文章,希望你能稍微了解一些Lua的基础知识,再来阅读更有益处。 在网上,很多人都在说Lua适合做游戏,但是怎么做?说的却知之甚少,更多的是长篇累牍的基础贴。脚本与C++的结合,如何能达到较高的效率?什么样的数据适合Lu... 阅读全文

posted @ 2013-04-11 10:13 cv_ml_张欣男 阅读(369) 评论(0) 推荐(0)

通过lua自带例子学习lua 08 (36-38)
摘要:-- Example 36 -- Standard Libraries - operating system facilities.-- OS functions:-- os.clock, os.date, os.difftime, os.execute, os.exit, os.getenv,--... 阅读全文

posted @ 2013-04-06 16:35 cv_ml_张欣男 阅读(325) 评论(0) 推荐(0)

通过lua自带例子学习lua 07 (31-35)
摘要:-- Example 31 --[[Standard LibrariesLua has standard built-in libraries for common operations inmath, string, table, input/output & operating system f... 阅读全文

posted @ 2013-04-06 16:31 cv_ml_张欣男 阅读(236) 评论(0) 推荐(0)

通过lua自带例子学习lua 06 (26-30)
摘要:-- Example 26 -- Functions.-- Define a function without parameters or return value.function myFirstLuaFunction()print("My first lua function was calle... 阅读全文

posted @ 2013-04-06 16:16 cv_ml_张欣男 阅读(280) 评论(0) 推荐(0)

通过lua自带例子学习lua 05
摘要:-- Example 21 -- repeat until statement.a=0repeata=a+1print(a)until a==5-------- Output ------12345-- Example 22 -- for statement.-- Numeric iteration... 阅读全文

posted @ 2013-04-06 15:41 cv_ml_张欣男 阅读(156) 评论(0) 推荐(0)

通过lua自带例子学习lua 04
摘要:-- Example 16 -- if statement.-- Simple if.a=1if a==1 thenprint ("a is one")end-------- Output ------a is one-- Example 17 -- if else statement.b="hap... 阅读全文

posted @ 2013-04-06 15:29 cv_ml_张欣男 阅读(208) 评论(0) 推荐(0)

通过lua自带例子学习lua 03
摘要:-- Example 11 -- Numbers.-- Multiple assignment showing different number formats.-- Two dots (..) are used to concatenate strings (or a-- string and a... 阅读全文

posted @ 2013-04-06 15:22 cv_ml_张欣男 阅读(229) 评论(0) 推荐(0)

通过lua自带例子学习lua 02
摘要:-- Example 6 -- Case Sensitive.-- Lua is case sensitive so all variable names & keywords-- must be in correct case.ab=1Ab=2AB=3print(ab,Ab,AB) -------... 阅读全文

posted @ 2013-04-06 15:17 cv_ml_张欣男 阅读(263) 评论(0) 推荐(0)

通过lua自带例子学习lua 01
摘要:-- Example 1 -- First Program.-- Classic hello program.print("hello")-------- Output ------hello-- Example 2 -- Comments.-- Single line comments in L... 阅读全文

posted @ 2013-04-06 15:02 cv_ml_张欣男 阅读(223) 评论(0) 推荐(0)

(转)LUA和C之间的函数调用
摘要:LUA和C之间的函数调用1.1 从C程序调用LUA函数LUA的函数和普通变量一样也是First Class Variable类型,可以看作函数指针变量参与栈操作。因此调用过程分为如下几个步骤:请求LUA函数(指针)入(GLOBAL)栈。将函数需要的参数入栈,入栈顺序按照参数被声明的顺序。告知LUA虚拟机入栈参数的个数、函数返回值的个数,并调用此LUA函数。从栈定获得返回值,先返回的先入栈,然后将返回值显式出栈。1.2 从LUA脚本调用C函数LUA没有提供PYTHON那样丰富的类库,因此复杂的功能需要在C程序中定义好,然后通过lua决定调用时机。在LUA库中定义了可以被LUA虚拟机识别的C函数模 阅读全文

posted @ 2013-04-03 10:47 cv_ml_张欣男 阅读(321) 评论(0) 推荐(0)

lua入门(一)
摘要:第一章 起点1.1 ChunkChunk 是一系列语句,lua执行的每一块语句,比如一个文件或者交互模式下的每一行都是一个Chunk。每个语句结尾的分号(;)是可选的。一行可写多个语句,建议用分号(;)隔开。交互模式下,调用os.exit()函数退出。-i选项要求Lua运行指定Chunk后进入交互模... 阅读全文

posted @ 2013-04-02 16:21 cv_ml_张欣男 阅读(180) 评论(0) 推荐(0)

导航