
Lua
wanglang3081
这个作者很懒,什么都没留下…
展开
-
android和iOS平台的崩溃捕获和收集
通过崩溃捕获和收集,可以收集到已发布应用(游戏)的异常,以便开发人员发现和修改bug,对于提高软件质量有着极大的帮助。本文介绍了iOS和android平台下崩溃捕获和收集的原理及步骤,不过如果是个人开发应用或者没有特殊限制的话,就不用往下看了,直接把友盟sdk(一个统计分析sdk)加入到工程中就万事大吉了,其中的错误日志功能完全能够满足需求,而且不需要额外准备接收服务器。 但是如果你对其原理更感转载 2015-12-03 18:05:44 · 886 阅读 · 0 评论 -
chapter23 The Operating System Library
The Operating System library includes functions for file (not stream) manipulation,for getting the current date and time, and other facilities related to theoperating system. It is defined in tabl翻译 2014-01-14 16:44:14 · 845 阅读 · 0 评论 -
chapter 22 The I/O Library
The I/O library offers two different models for file manipulation. The simplemodel assumes a current input file and a current output file, and its I/O operationsoperate on these files. The complet翻译 2014-01-14 16:24:05 · 895 阅读 · 0 评论 -
chapter 21 -2 The String Library
Tab expansionAn empty capture like ‘()’ has a special meaning in Lua. Instead of capturingnothing (a quite useless task), this pattern captures its position in the subjectstring, as a number:p翻译 2014-01-14 11:20:47 · 767 阅读 · 0 评论 -
chapter 21 The String Library
The power of a raw Lua interpreter to manipulate strings is quite limited. Aprogram can create string literals, concatenate them, and get string lengths.But it cannot extract substrings or examine翻译 2013-12-30 15:58:34 · 1275 阅读 · 0 评论 -
在Lua脚本中使用OpenGL函数
主要因为单纯的学习Lua太枯燥了,所以先学些了Lua基本语法然后就直接学习了与C语言的相互调用,所以以后的OpenGL代码都用Lua写,这样更容易理解Lua以及提高学习兴趣。下面是这2天的代码包括C语言部分和Lua部分,因为公司环境是Ubuntu的所以我用glut库使代码在Linux和windows下都可以使用。C语言代码如下:[cpp] view plaincopy转载 2014-01-13 11:18:10 · 1872 阅读 · 0 评论 -
chapter 17 Weak Tables and Finalizers
17 Weak Tables and FinalizersLua does automatic memory management. Programs create objects (tables,threads, etc.), but there is no function to delete objects. Lua automaticallydeletes object翻译 2013-12-26 16:35:11 · 907 阅读 · 0 评论 -
chapter 16 Object-Oriented Programming
Account = {balance = 0}function Account.withdraw (v)Account.balance = Account.balance - v , 在 函数里面我们hardcode the global name : Account,bad pratice.endAccount.withdraw(100.00) -- ok.翻译 2013-12-26 11:49:33 · 738 阅读 · 0 评论 -
chapter15 Modules and Packages-01
Starting in version 5.1, Lua has defined a set of policies for modules and packages(a package being a collection of modules). These policies do not demand anyextra facility from the language () ;翻译 2013-12-25 15:59:18 · 787 阅读 · 0 评论 -
Chapter 14 The Environment
Lua keeps all its global variables in a regular table, called the global environment.(To be more precise, Lua keeps its “global” variables in several environments,but we will ignore this multipl翻译 2013-12-23 15:20:12 · 912 阅读 · 0 评论 -
chapter 24 The Debug Library
The debug library does not give you a debugger for Lua,Lua 没Debuger?, but it offers all the primitivesthat you need for writing your own debugger. For performance reasons,the official interface to翻译 2014-01-15 16:51:36 · 985 阅读 · 0 评论 -
chapter 27 Calling C from Lua
When we say that Lua can call C functions, this does not mean that Lua cancall any C function. As we saw in the previous chapter, when C calls a Luafunction, it must follow a simple protocol to翻译 2014-01-21 16:40:22 · 1797 阅读 · 0 评论 -
chapter 28 Techniques for Writing C Functions
Both the official API and the auxiliary library provide several mechanisms tohelp writing C functions. In this chapter, we cover the mechanisms for arraymanipulation, for string manipulation, an翻译 2014-01-26 16:53:29 · 810 阅读 · 0 评论 -
tolua
tolua提供几个 C++ 与 Lua 进行数据交换的工具函数。~~tolua.type返回一个 C++ 对象的类型描述字符串。local node = display.newNode()print(tolua.type(node)) -- 输出 CCNode~~tolua.cast强制转换对象类型,用途请参考 CC转载 2015-06-07 18:19:42 · 1119 阅读 · 0 评论 -
对 Lua 字节码进行加密
对 Lua 字节码进行加密由于 luajit 不支持 64 位,quick 新的版本默认使用 lua 5.1.5 版本,并提供将 lua 源码打包成通用字节码的工具 luac 。为了增强安全性, quick 提供了一个基本加密方案,使开发者可以对字节码作自定义的加密,防止对字节码的简单反编译工作。此方案配合原有的XXTEA加密方案,已经能够满足普通的加密需要。如果开发者需要更高强度的加密,可以转载 2015-04-22 10:24:20 · 6937 阅读 · 0 评论 -
How to use bindings-generator to generate lua binding automatically
How to use bindings-generator to generate lua binding automaticallySince cocos2d-x 3.0, we use bindings-generator to generate lua bindings for c++ automatically.The bindings-generator is based o转载 2014-08-16 22:34:27 · 2195 阅读 · 1 评论 -
chapter15 Modules and Packages-02
SearchersIn reality, require is a little more complex than we have described. The searchfor a Lua file and the search for a C library are just two instances of a moregeneral concept of searchers翻译 2013-12-26 10:54:04 · 772 阅读 · 0 评论 -
Lua的C++封装
前段时间由于公司项目需要,做了LUA的C++封装,为此看了LuaPlus(感觉过于庞大,挺混乱的..)跟LuaTinker(一个韩国人写的,只有两个代码文件,实现了大多数需要的功能)的代码,在实现LUA与C++的交互中最重要的功能莫过于实现在LUA中注册任意类型的C++函数和类,现将自己所得到的一些方法简单说下,如有不对的地方还请各位多多指正 注册C++函数当Lua 调用C 函数的时转载 2014-07-10 22:50:15 · 1695 阅读 · 0 评论 -
在XCODE项目中使用lua--xcode 4.2
从http://www.lua.org 下载Lua ,解压缩打开你要添加使用lua的项目工程,选择点击左侧工程管理文件,点击右边资源栏下方Add Target,选择添加一个 static Libarary 工程.取名叫lua将解压后的lua src文件 拖动到工程新生成的lua 文件夹下,去掉Create external build前面的勾next 后选择target转载 2014-06-11 22:05:43 · 7023 阅读 · 0 评论 -
Lua upvalue definition
Lua is a lexically scoped language.The scope of a local variable begins at the first statement afterits declaration and lasts until the last non-void statementof the innermost block that includes the转载 2014-07-23 12:20:59 · 551 阅读 · 0 评论 -
chapter 26 Extending Your Application
An important use of Lua is as a configuration language. In this chapter, we willillustrate how we can use Lua to configure a program, starting with a simpleexample and evolving it to perform inc翻译 2014-01-20 16:05:00 · 759 阅读 · 0 评论 -
chapter 25 An Overview of the C API
The C API is the set of functions that allow C code to interact with Lua. Itcomprises functions to read and write Lua global variables, to call Lua functions,to run pieces of Lua code, to regist翻译 2014-01-15 17:00:02 · 912 阅读 · 0 评论 -
关于Lua模式匹配学习教程
Lua并不使用POSIX规范的正则表达式[4](也写作regexp)来进行模式匹配。主要的原因出于程序大小方面的考虑:实现一个典型的符合POSIX标准的regexp大概需要4000行代码,这比整个Lua标准库加在一起都大。AD:2013云计算架构师峰会课程资料下载关于Lua模式匹配学习是本文要介绍的内容,主要是来学习Lua中模式匹配的问题,具体内容的实现来卡本文详解。模式匹配函:在转载 2013-12-23 15:47:28 · 829 阅读 · 0 评论 -
Lua 标准库 - 输入输出处理(input and output facilities)
Lua 标准库 - 输入输出处理(input and output facilities)责任编辑:cynthia作者:来自ITPUB论坛 2008-02-18 文本Tag: Lua 【IT168 技术文档】I/O库提供两种不同的方式进行文件处理 1、io表调用方式:使用io表,io.open将返回指定文件的描述,并且所有的操作将围绕这个文件描述 io表同转载 2013-12-03 11:45:12 · 711 阅读 · 0 评论 -
Chapter1 Lua 中的转义字符 and get start with Lua ,Types and Value
搞了这么多年programe, \n \t ,\\ \' \"" 就知道其转义,但\ddd \xhh 其实一直没搞明白,直到今天细细的读 programming in Lua 3rd englist version , I just get the meaningpint("a"); , can als be write in print("\97"); or print("\x61");原创 2013-11-20 19:02:15 · 4047 阅读 · 0 评论 -
Chapter 6 More about Functions
Functions in Lua are first-class values with proper lexical scoping.What does it mean for functions to be “first-class values”? It means that,in Lua, a function is a value with the same rights as翻译 2013-11-27 15:45:27 · 1115 阅读 · 0 评论 -
chapter 4 Statements
4.1 Assignmenta = "hello" .. "world"t.n = t.n + 1 multiple assignment, elements separated by commas. For instance, in the assignmenta, b = 10, 2*xthe variable a gets the value 10 and b get翻译 2013-11-22 16:02:33 · 1107 阅读 · 0 评论 -
Lua源码阅读一——在Windows下编译
最近感觉没啥可看,就看一下lua源码,打发打发时间吧。首先需要下载编译lua源码了,笔者是在Windows+VS2005下编译通过 1.首先需要去官方网站上下载lua源码,到www.lua.org上下载lua源码,目前最新版本是5.1 RC4版本lua-5.1.4.tar.gz,解压之后,目录下有install文件,在该文件中详细说明了在linux下编译的过程,visual studi转载 2013-11-21 10:12:12 · 1015 阅读 · 0 评论 -
Compiling Lua with Visual Studio 2010
Compiling Lua with Visual Studio 2010Lua?Lua is a dynamic, object-oriented, interpreted language. Most programmers are aware of it as the scripting language used in the game World of Warcraft,转载 2013-11-21 11:39:10 · 1860 阅读 · 0 评论 -
Build Lua on window hit Link error
mekkatorqu (292)So I've been following this tutorialhttp://www.youtube.com/watch?v=X5D_h2X8LCk , however Im getting errors about thaat my lib is not linked, however, IT IS, I have included both in转载 2013-11-21 11:22:22 · 1670 阅读 · 0 评论 -
ios开发愤怒的小鸟的Lua语言:Wax框架详解(一)
核心提示:我们都知道Objective-C和Cocoa语言可以开发iOS应用,但是一年前,苹果决定在iOS系统上使用Lua语言。Wax框架的想法很简单:凡是Objective-C能做的,Lua也能做! 2011年6月的编程语言排行榜Lua语言一军突起,一举进入前十名。这与一年前苹果决定在iOS系统上使用Lua语言密不可分。但是,你了解如何用Lua语言在iOS上转载 2013-11-20 10:14:26 · 2042 阅读 · 0 评论 -
用Lua编写iOS程序
原文:http://luanova.org/ioswithlua/ 本文讨论用Lua创建iOS应用的3种方法。包括用Lua创建完整的应用(Corona)一直到用Lua作为app中的脚本元素(通过Wax或diy)。在此之前,我们需要问自己两个问题:1、为什么要使用Lua?2、苹果允许使用Lua吗?这两个问题是紧密相关的。如果你在此之前对Lua一无所知,我会简单介绍一下Lu转载 2013-11-20 10:11:43 · 937 阅读 · 0 评论 -
chapter 8 Compilation, Execution, and Errors
Although we refer to Lua as an interpreted language, Lua always precompilessource code to an intermediate form before running it.Previously, we introduced dofile as a kind of primitive opera翻译 2013-11-29 18:41:05 · 1254 阅读 · 0 评论 -
chapter 3Expressions
math.floor 功 能: 返回小于或者等于指定表达式的最大整数 .The following rule defines the modulo operator:a % b == a - math.floor(a/b)*b ,取模竟然可以这样表达出来For integer operands, it has the usual meaning, with the result al翻译 2013-11-22 14:23:31 · 1118 阅读 · 0 评论 -
chapter 9Coroutines
A coroutine is similar to a thread (in the sense of multithreading): it is a lineof execution, with its own stack, its own local variables, and its own instructionpointer; but it shares global var翻译 2013-12-02 16:25:11 · 682 阅读 · 0 评论 -
Chapter 13 Metatables and Metamethods
Usually, each value in Lua has a quite predictable set of operations.[其实就相当于C++ 里面每一类型都有自己预定义的operator, we can overwirte the default operator ]We can add numbers, we can concatenate strings, we can翻译 2013-12-19 18:12:41 · 1453 阅读 · 0 评论 -
chapter 12 Data Files and Persistence
12.1 Data Files Table constructors provide an interesting alternative for file formats. With alittle extra work when writing data, reading becomes trivial. The technique is towrite our data fi翻译 2013-12-19 11:24:27 · 879 阅读 · 0 评论 -
Chapter 7Iterators and the Generic for
7.1 Iterators and ClosuresAn iterator is any construction that allows you to iterate over the elements of acollection. In Lua, we typically represent iterators by functions:each time wecall th翻译 2013-11-28 18:57:51 · 825 阅读 · 0 评论 -
chapter 11 Data Structures
11.1 ArraysWe implement arrays in Lua simply by indexing tables with integers. Therefore,arrays do not have a fixed size, but grow as needed. Usually, when we initializethe array we define its s翻译 2013-12-17 16:51:39 · 1132 阅读 · 0 评论 -
chapter 5 Functions
if the function call has no arguments, we still must write an empty list () to denote the call.There is a special case to this rule: if the function has one single argument and that argumen翻译 2013-11-26 13:09:32 · 836 阅读 · 0 评论