zoukankan      html  css  js  c++  java
  • Lua基本语法

    1、Lua中的变量类型有:

    a = 1         --number

    b = "abc"    --string

    c = {}       --table

    d = print    -- function

    e = true     --bool

    2、Lua变量名大小写敏感,不要以_开头,这些都表示一些特殊变量

    3、关键字: and、beak、do、else、elseif、end、false、for、function、if、in、local、nil、not、or、repeat、return、then、true、until、while

    4、string类型的字面值有:“”、‘’、和多行字符串[[ ]]三种

    5、Lua允许多个变量同时赋值,例如: a,b = 1,2   a,b = b,a表示交换两个变量

    6、输出到console的方式: print("hello world")、  io.write("hello world")

    t = {name = "kylin", age = 18, gender = "male"}  -- 此为一个table类型的变量

  • 相关阅读:
    字符串哈希
    codeforces#766 D. Mahmoud and a Dictionary (并查集)
    莫比乌斯反演模板
    马拉车模板
    codeforces#580 D. Kefa and Dishes(状压dp)
    1076E
    448C
    543A
    295B
    poj3974 Palindrome
  • 原文地址:https://www.cnblogs.com/kylinxue/p/4617819.html
Copyright © 2011-2022 走看看