-e:直接將命令傳入 Lua
prompt> lua -e "print(math.sin(12))" --> -0.53657291800043
-l:加載一個文件.
-i:進入交互模式.
_PROMPT 內置變量做爲交互模式的提示符
prompt> lua -i -e "_PROMPT=' lua> '"
lua>函數
type.lua測試
print(type(a)) --> nil ('a' is not initialized) a = 10 print(type(a)) --> number a = "a string!!" print(type(a)) --> string a = print -- yes, this is valid! a(type(a)) --> function
執行lua:this
type中字符串使用雙引號lua
type中字符串使用單引號spa
其中lua版本:命令行
註釋:code
在-e將命令傳入lua時,type函數中,單引號和雙引號的結果不同ip