游戏热更新(XLua)专题四

时间:2019-02-11
本文章向大家介绍游戏热更新(XLua)专题四,主要包括游戏热更新(XLua)专题四使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
--------------------------------------------------------------------hello world
print("Hello world!");

--------------------------------------------------------------------定义一个变量
--lua是没有编译的,在运行的时候,会自动识别我们的类型
--数字
a=10
print(a)
--string
a="今天天气很好"
print(a)
--null
a=nil
print(a)


---------------------------------------------------------------------数据类型结构
--数据类型是string
a="Hello world"
a=type(a)
print(a)

--数字类型num
print(type(1.0))
print(type(88))

--布尔类型boolean
print(type(true))
print(type(false))

--方法function
print(type(type))

--空nil
print(type(nil))

---------------------------------------------------------------------tabel
--lua不是一门面向对象的语言,所以没有传统意义上的类
--可以利用table这种特殊的数据结构,实现类似类的功能
--table数据类型?
tab1={word="大家国庆节快乐",say="马上要元旦了"}
print(tab1.word)
print(tab1.say)
print(tab1)

----------------------------------------------------------------------数据结构
--顺序结构
print("1");
print("2");

--分支结构
if	false then
	print("满足了条件")
end

----------------------------------------------------------------------循环结构
for a=1,10,1 do
	print(a)
end

player={"linda","peter","merry"}
for key,value in ipairs(player) do
	print(key)
	print(value)
end