-
sting format查看全部
-
數組的最后一個末尾別忘加“,”,函數的格式為 function-end查看全部
-
lua語言的字符類型不能用漢字賦值,否則會輸出亂碼 eg. a="慕課網",print(a)會輸出亂碼查看全部
-
lua:<br> 表達式像python a = 1 但是又有不同,a,b = 1,2 在交換值的時候也有簡潔的方式 a,b = b,a<br> if語句的格式:<br> if .. then<br> <br> elif .. then<br> <br> else<br> end<br> <br> while i<0 do<br> ..<br> end<br> <br> for i=1,10,1 do<br> ..<br> end<br> <br> for k,v in pair(a) do<br> ..<br> end<br> <br> 其次 pair是對tables的迭代循環,ipair是對tables中的數組迭代<br> <br> 導入包用require 和javascript一樣<br> <br> 函數則和javascript很像,函數式編程<br> <br> 注意點:<br> 1.lua的數組是1開頭的<br> 2.lua的值都是全局變量,記得加local<br> 3.lua用..連接兩個字符串<br> 4.lua能return多個值查看全部
-
for查看全部
-
ipairs遍歷table當中的數組部分 pairs遍歷table當中的所有查看全部
-
lua可以有多個返回值, 萬物皆數值,包括函數查看全部
-
tonumber, tostring #取長度查看全部
-
游戲查看全部
-
介紹內省功能查看全部
-
--test.lua local c=requre("foo') print(c.foo(1,2))查看全部
-
--foo.lua local class={} function class.foo(a,b) return a+b end return class查看全部
-
Lua的包(package) ```lua --foo.lua -------------- function class.foo(a,b) return a+b end return class --test.lua -------------- local c=require("foo") ```查看全部
-
pair遍歷table是一種散列的遍歷形式查看全部
-
數組遍歷查看全部
舉報
0/150
提交
取消