Lua的自我学习之路-语法学习1

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/asdfghj253/article/details/80293370

要点1:
   Lua句末的分号可不写,但我习惯性写上
print("hello World");
print("hello World")

要点2:注释
单行注释:主要是前面2个 "-"
--printfddsa 单行注释
多行注释:"--[[      ]]--“

--[[ 多行注释--]]

要点3:lua语言没有类型
 书写string字符串类型:
print("hello www.baidu.com");
print('hello sdl');--string字符串单引号和双引号都可以

书写int类型:
b=10;

为空时:lua会输出nil,  nil就相当于null
print(type(nil)); --返回的是"nil" 不是nil
lua语言中print方法返回的都是字符串



猜你喜欢

转载自blog.csdn.net/asdfghj253/article/details/80293370