Lua內(nèi)置提供了一些常用的函數(shù)幫助我們開發(fā)
1,數(shù)學(xué)處理的math相關(guān)函數(shù)
2,字符串處理的string相關(guān)函數(shù)
3,表處理的table相關(guān)函數(shù)
4,文件操作的io相關(guān)函數(shù)
數(shù)學(xué)運(yùn)算函數(shù)math
math.abs
math.cos
math.max
math.maxinteger
math.min
math.random
math.sin
math.sqrt
math.tan
字符串處理相關(guān)函數(shù)
string.byte
string.char
string.find
sting.format
string.lower
string.sub
string.upper
.. 字符串相加
tostring()? 把一個數(shù)字轉(zhuǎn)化成字符串
tonumber() 把一個字符串轉(zhuǎn)化成數(shù)字
表相關(guān)的函數(shù)
1.table.concat
把表中所有數(shù)據(jù)連成一個字符串
2,table.insert
向指定位置插入一個數(shù)據(jù)
3,table.move
移動數(shù)據(jù)
4,table.pack
包裝成一個表
5,table.remove
移除指定位置的數(shù)據(jù)
6,table.sort
排序
7,table.unpack
返回一個數(shù)組,指定范圍的數(shù)組