lua

以下是为您整理出来关于【lua】合集内容,如果觉得还不错,请帮忙转发推荐。

【lua】技术教程文章

Lua基本类型和基本运算【代码】【图】

print(a) a=10 a=nil print(a) print(type(false)) print(type(nil)) print(type({})) print(type(12)) print(type("hello")); print(type(type)); print(type) a=type --变量可以是函数,a应该只是一个指针,void * print(a(type))--[[ type函数:可以判断出变量的类型。1.nil 类型,类似java里面的null,一个全局变量没有赋值的时候,默认是nil 2.booleans 类型,取值为:true ,false.但是在控制语句中,所有值都可以是布尔值,除...

C++混合编程之idlcpp教程Lua篇(2)【代码】【图】

在上一篇 C++混合编程之idlcpp教程(一) 中介绍了 idlcpp 工具的使用。现在对 idlcpp 所带的示例教程进行讲解,这里针对的 Lua 语言的例子。首先看第一个示例程序 LuaTutorial0。像很多语言的第一个例子一样,是一个打印 Hello world 的程序。用Visual Studio 2015打开解决方案文件 tutorials\LuaTutorials\LuaTutorials.sln,其下已经有多个工程文件。 在工程LuaTutorial0中,已经加入了三个文件,分别是 LuaTutorial0.cpp, Tutor...

Unity+ Lua入门

相信你搜索这篇文章时,已经决定使用Lua来做热更新了,那么,这里将讲述如何 做好准备工作,即Unity+Lua环境的搭建及简单入门样例。一、下载LuaInterfaceLuaForWinhttps://code.google.com/p/luaforwindows/downloads/list OrLua http://files.luaforge.net/releases/luainterface/luainterface二、使用新建unity项目,解压两个dll到Assets目录下,新建C#脚本test.cs,VS打开脚本,添加引用(项目子菜单引用->右键->添...

mac下lua环境搭建笔记

下载lua源码包,进入到根目录下1、执行make macosx2、然后再sudo make install即可本文出自 “CocosDev” 博客,请务必保留此出处http://xuzhiwei.blog.51cto.com/978424/1405421原文:http://xuzhiwei.blog.51cto.com/978424/1405421

CC3.2+Lua(3) ——Lua之class【图】

【唠叨】 在使用Lua的时候,cocos2d-x为我们提供了一个 class(classname, super) 这个函数。 它可以让我们很方便的定义一个类,或者继承cocos2d-x的某个类。 PS:class()是cocos2d-x为我们封装的函数,本身Lua没有这个函数。【class】 class函数是在"cocos2d-x-3.2/cocos/scripting/lua-bindings/script/extern.lua"中定义的。-- Create an class.functionclass(classname, super) local superType = type(super) ...

《自己实现Lua》一书Windows代码【图】

这书长这样书都是Mac上的代码,太为难我Windows用户了,因此放上Windows相关执行代码(G站链接),不要苦了孩子代码随读书进度更新中原文:https://www.cnblogs.com/caiger-blog/p/12239516.html

lua 模块与环境【代码】

编写一个模块的最简单方法:-- complex.lua--模块实际上是一个表complex ={}--定义模块函数function complex.add(c1,c2)...end--调用模块内部的函数,需要complex.前缀function complex.callAdd(c1,c2) complex.add(c1,c2)end--之前的声明把所有函数都放入complex表中了,最后返回这个表return complex调用这个模块时:-- main.lualocal complex =require("complex")complex.add(x,y)上述代码有几点麻烦:1.在模块内部,一个函数...

(转) lua api 解释【代码】

这些东西是平时遇到的, 觉得有一定的价值, 所以记录下来, 以后遇到类似的问题可以查阅, 同时分享出来也能方便需要的人, 转载请注明来自RingOfTheC[ring.of.the.c@gmail.com] 打算记录一些lua_api, 可能会觉得lua文档中已经说的很清楚了, 但是我将用自己的方式, 记录下我认为重要的东西, 先约定一下api说明的格式编号. api作用简述api函数原型api操作说明返回值说明对栈的影响注意事项 1. 建一个新表void lua_createtable (lua_Sta...

openresty lua获取微秒和毫秒【代码】

time_helper.lualocal _M = {}; local ffi = require("ffi") ffi.cdef[[ struct timeval { long int tv_sec; long int tv_usec; }; int gettimeofday(struct timeval *tv, void *tz); ]]; local tm = ffi.new("struct timeval");-- 返回微秒级时间戳 function _M.current_time_millis() ffi.C.gettimeofday(tm,nil); local sec = tonumber(tm.tv_sec); local usec = tonumber(tm.tv_...

luaJIT FFI Library【代码】

LuaJITFFI LibraryThe FFI library allows calling external C functions and using C data structures from pure Lua code.The FFI library largely obviates the need to write tedious manual Lua/C bindings in C. No need to learn a separate binding language — it parses plain C declarations! These can be cut-n-pasted from C header files or reference manuals. It‘s up to the task of binding large libraries w...

LUA - 相关标签