一、lua基础知识1

来源:互联网 发布:windows pro embedded 编辑:程序博客网 时间:2024/04/30 14:58

一、lua 的数据类型

--类型
a=1; --number
print(type(a)) --number


b="HelloWorld";
print(type(b)) --string  两种数据类型




c=true;
print(type(c)) --boolean    true  或者  false


d = print;
d("HelloWorld");
print(type(d)); --function类型  


e = {1,2,3,{name="hh",1,2,3}}
print(type(e)); --table类型  没有字典 数组等类型






f = nil;
print(type(f));   --nil   如果想要删除一个对象   将它赋值nil即可


b = 12;
print(type(b));  -- 可以修改b的类型为number  但是不推荐这样使用  


h = coroutine.create(function() end);
print(type(h)); ---thread   协程类型      和线程类似
-- userdata    数据类型



1、配置文件  --游戏第一次启动   新游戏

2、 全局操作的数据    --C++单例模式

3、 全局数据的初始化    --第一次



0 0
原创粉丝点击