zoukankan      html  css  js  c++  java
  • 通过lua自带例子学习lua 01

    -- Example 1   -- First Program.

    -- Classic hello program.
    
    print("hello")
    
    -------- Output ------
    
    hello

    -- Example 2   -- Comments.

    -- Single line comments in Lua start with double hyphen.
    
    --[[ Multiple line comments start
    with double hyphen and two square brackets.
      and end with two square brackets. ]]
    
    -- And of course this example produces no
    -- output, since it's all comments!
    
    
    
    -------- Output ------

    -- Example 3 -- Variables.

    -- Variables hold values which have types, variables don't have types.
    
    a=1
    b="abc"
    c={}
    d=print
    
    print(type(a))
    print(type(b))
    print(type(c))
    print(type(d))
    
    
    -------- Output ------
    
    number
    string
    table
    function


    -- Example 4 -- Variable names.

    -- Variable names consist of letters, digits and underscores.
    -- They cannot start with a digit.
    
    one_two_3 = 123 -- is valid varable name
    
    -- 1_two_3 is not a valid variable name.
    
    
    
    -------- Output ------


    -- Example 5 -- More Variable names.

    -- The underscore is typically used to start special values
    -- like _VERSION in Lua.
    
    print(_VERSION)
    
    -- So don't use variables that start with _,
    -- but a single underscore _ is often used as a
    -- dummy variable.
    
    
    
    -------- Output ------
    
    Lua 5.1
  • 相关阅读:
    Django-分页器
    Django-利用Form组件和ajax实现的注册
    Django之auth用户认证
    django之跨表查询及添加记录
    Django之queryset API
    bootstrip CSS
    bootstrip安装
    Django之环境安装
    前端之jQuery基础篇02-事件
    前端之jQuery基础篇
  • 原文地址:https://www.cnblogs.com/sdlypyzq/p/3002427.html
Copyright © 2011-2022 走看看