Lua之转义字符
- print("\a"); --bell 硬件滴一声
- print("a");
- print("\b"); --back space 空格
- print("b");
- print("\f"); --from feed填充表格
- print("\n"); --new line换行
- print("\r"); --carriage reurn返回当前行第一列
- print("\t"); --horizontal tab 水平换行
- print("\v"); --填充表格
- print("\\"); --backslach单斜杠
- print("\""); --double quote双引号
- print("\'"); --single quote单引号
- print("\["); --left square bracket左中括号
- print("\]"); --right square bracket
- ---------------------------------------------
- print("one line\nnext line\n\"in quote\",\'in quotes\'");
- print("''"); --可以
- --print("" ""); --不可以
- print("\"\""); --必须转意字符
- ---------------照原样输出-----------------------------------
- page = [[
- \n\tttt\nn\yy
- <.>
- <>
- <>
- hh
- ]];
- print(page);
- io.write(page); --用这种方法忽略转意字符按原样输出
- --------------------lua的智能----------------------
- print(10 .. 20); --..操作符必须加空格
- print("10"+1);
- print("10+1");
- line = io.read();
- n= tonumber(line); --将读入的数据强制转换为number
- if n == nil then
- error(line .. " is vaild number");
- else
- print(n*2);
- end
- print(tostring(10) == "10");
- print(1 .. 0 == "10");
- print(10 .. "" == "10"); --数字和字符串..为字符串"10"
- print("10"+1 == 11); --数字和字符串+ 为数字11
- print(4 and 5); --第一个为真第二个也为真 则输出第二个<pre name="code" class="html">a and b -->如果a为false 则返回a 否则返回b
- a or b -->如果a为true则返回a 否则返回b
- and 优先级比 or高
- x = x or v;
- ==>
- if not x then
- x=v;
- end</pre><br>
- <pre></pre>
- <pre name="code" class="plain"><pre></pre>
- <pre></pre>
- </pre>
Lua之转义字符的更多相关文章
- cocos2d-x -Lua 字符串
字符串或串(String)是由数字.字母.下划线组成的一串字符. Lua 语言中字符串可以使用以下三种方式来表示: 单引号间的一串字符. 双引号间的一串字符. [[和]]间的一串字符. 以上三种方式的 ...
- Lua 转义字符
[1]Lua语言在Windows环境中的文件路径写法 示例程序如下: -- test1 local file = io.open("E:\test\100.txt", 'rb') ...
- lua 字符串 正则表达式 转义 特殊字符
string.gsub 函数有三个参数:目标串,模式串,替换串.基本作用是用来查找匹配模式的串,并将使用替换串其替换掉: s = string.gsub("Lua is good" ...
- Lua字符串库
1. 基础字符串函数: 字符串库中有一些函数非常简单,如: 1). string.len(s) 返回字符串s的长度: 2). string.rep(s,n) 返回字符串s重复n次的结 ...
- Lua学习笔记一
学习了有一周多了.之前一直不想献丑,但还是记录下这个过程. 第1章 开发软件搭建 1. ubuntu 下lua安装 sudo apt-get install lua5.1 2.win下的环境搭建. ...
- Lua字符串库(整理)
Lua字符串库小集 1. 基础字符串函数: 字符串库中有一些函数非常简单,如: 1). string.len(s) 返回字符串s的长度: 2). string.rep(s,n) 返回 ...
- Lua 之string库
标准string库 基础字符串函数 string.len(s) 返回一个字符串的长度,例如 string.rep(s, n) 返回一个新的字符串,该字符串是参数s重复n次得到的结果,例如 )) -- ...
- Lua简易入门教程
环境:lua for windows (lfW)主页:http://luaforwindows.luaforge.net/https://code.google.com/p/luaforwindows ...
- Lua程序设计入门
在Lua中,一切都是变量,除了关键字.TTMD强大了. 1.注释 -- 表示注释一行 --[[ ]]表示注释一段代码,相当于C语言的/*....*/ 注意:[[ ... ]]表示一段字符串 2.lua ...
随机推荐
- layer关闭弹出层,弹出打印
常规的话,下面能够完成关闭弹出层 var index = parent.layer.getFrameIndex(window.name); //延迟关闭 解决打印窗口弹不出来的情况 parent.la ...
- 卡西欧(casio)Fx-5800p程序调试器||模拟器V1.0
一.[背景] 都说这个卡西欧5800p没有模拟器,模拟器其实就是个电脑上面模拟他的界面的东西,但是真正的核心,他不一定有,而且我们测量方面的编程及时有了所谓的外形模拟器也学不会的. 都说这个卡西欧58 ...
- Error: Java heap space
在chd中 的hive中执行 (select count (*)) 或者mr程序都报Error: Java heap space 4.io.sort.mb 的作用 排序所使用的内存数量. 默认值 ...
- STM32 ACM Linux 驱动添加
kernel 内驱动添加如下: x Symbol: USB_ACM [=y] x x Type : tristate x x Prompt: USB Modem (CDC ACM) support x ...
- Go Revel - Session / Flash(会话与flash)
##Session / Flash 作用域 revel提供了两种cookies存储机制: // 一个加密签过的cookie (限制为4kb). // 限制: Key 中不能有冒号 type Sessi ...
- maven配置阿里云仓库
在mirrors的节点中添加: <mirror> <!--This sends everything else to /public --> <id>nexus-a ...
- 软件开发常用的linux命令心得
软件开发过程中难免要经常对主机进行配置或者部署等操作,想到一些就写一些了,以后再更新 解压命令: a.如果是tar文件,则直接用 “tar zxvf 文件名”: b.如果是zip文件,用 “unzip ...
- java socket 服务端 客户端
Server package com.witwicky.socket.basicsocket; import java.io.IOException; import java.io.InputStre ...
- SpringBoot的文件下载
SpringBoot的文件下载 2017年11月29日 10:32:20 阅读数:3907 SpringBoot的文件下载方法有很多,此处只记录使用Spring的Resource实现类FileSyst ...
- CREATESTRUCT cs 结构体
PreCreateWindow(CREATESTRUCT& cs) typedef struct tagCREATESTRUCT { LPVOID lpCreateParams; // 创建窗 ...