zoukankan      html  css  js  c++  java
  • Lua代码实例()

    01: hello world

    codes: 

    print("hello lua!")
    print("你好LUA")

    02. 

    a=1
    b="abc"
    c={}
    d=print
    
    print(type(a))
    print(type(b))
    print(type(c))
    print(type(d))

    Result:

      

    number
    string
    table
    function

    03.  注释

    on_two_3=123  --is valid varable name

    --表示注释语句

    print(_VERSION) --输出lua的版本
    ab=1
    Ab=2
    AB=3
    print(ab,Ab,AB)//1   2   3

    04. 

    AND=3
    print(AND) --3

    05 . 转义字符

    a="single 'quoted' string and double \"quoted\" string inside"
    b='single \'quoted\' string and double "quoted" string inside'
    c=[[multiple line with 'single' and "double" quoted strings inside.]]
    
    print(a)
    print(b)
    print(c)

    结果:

    >lua -e "io.stdout:setvbuf 'no'" "02.lua"
    single 'quoted' string and double "quoted" string inside
    single 'quoted' string and double "quoted" string inside
    multiple line with 'single' and "double" quoted strings inside.
    >Exit code: 0

  • 相关阅读:
    Linux找回root密码
    关于Linux的随笔笔记
    需求征集系统进度03
    需求征集系统进度02
    需求征集系统进度01
    第六周总结
    阅读笔记03
    第一周总结
    第五周总结
    阅读笔记02
  • 原文地址:https://www.cnblogs.com/finger/p/2479601.html
Copyright © 2011-2022 走看看