字符串库
注:字符串在Lua中是不可变的,任何的string操作都不会去改变原有的字符串,都是返回新的字符串
一、一般函数
1. 求长度
s = "Hello LUA ";
print(string.len(s));
print(#s);
2. 重复
print(string.rep(s,3)); -- s 重复了3次
3. 大小写转换
print(stri...
分类:
其他好文 时间:
2014-05-12 15:08:08
阅读次数:
336
习惯了vi模式,在bash里配置input.rc可以使平时命令行操作都使用vi习惯,翻页和跳动光标都很方便但是当运行一些交互式程序时,比如redis-cli,lua等,它们却不按input.rc的配置来读取输出,经常快捷键操作出现乱码这是因为它们自己没有使用readline库来读取命令行输入解决办法...
分类:
其他好文 时间:
2014-05-12 11:05:01
阅读次数:
264
不论是windows下的程序,还是linux下的程序,开发环境都离不开三个目录:include、lib、bin,分别是头文件目录、库文件目录、运行文件目录。或许目录不叫这个名字,但却必不可少,除非你的程序是运行在虚拟机上或脚本文件如java、php、lua等。
在windows下,可以不怎么关...
分类:
系统相关 时间:
2014-05-12 10:08:34
阅读次数:
481
一、file was built for archive which is not the
architecture being linked (armv7s)
项目是基于cocos2d-x绑定lua进行开发的,需要引用liblua.a静态库,编译的时候报上面的错。需要将liblua项目中的buil...
分类:
其他好文 时间:
2014-05-12 08:16:45
阅读次数:
345
import java.util.Iterator;
import java.util.Scanner;
public class Stack implements Iterable {
private Node first;// 栈顶
private int N;// 元素数量
// 定义结点的嵌套类
private class Node{
Item item;
Node nex...
分类:
其他好文 时间:
2014-05-11 13:20:22
阅读次数:
257
//#include
#include
#include
//using namespace std;
//const int MAXN=10;
//int Stack[MAXN];
stack s;
class Solution {
public:
int getNumber(int x)
{
//int lengthOfStack=0;...
分类:
其他好文 时间:
2014-05-10 04:45:29
阅读次数:
231
程序员阿士顿的故事2011-03-19 21:37:51前几天有人在 Stack Exchange
上提了一个问题 How can a new programmer impress the software engineer
(boss)?(作为新手程序员如何给软件工程师出身的老板留下好印象?),J...
分类:
其他好文 时间:
2014-05-10 00:00:32
阅读次数:
583
那么Cowboy是什么呢?Cowboy is a small, fast and
modular HTTP server written in Erlang.其定位非常明确:Cowboy aims to provide a complete
HTTP stack in a small code ba...
分类:
Web程序 时间:
2014-05-09 23:06:24
阅读次数:
411
一、数学库
1. 随机数
math.randomseed(os.time()); -- 设置随机种子
for i=1, 100 do
print(math.random(-1000,1000)); -- 随机区间 [-1000,1000], math.random(1000) 表示 [1,1000]
end;
2. 最大,最小值
math.max...
分类:
其他好文 时间:
2014-05-09 20:58:11
阅读次数:
669
没考虑到的情况有:input: [, expected: false; 语法上也犯了错误:
我定义的stack的泛型为char,泛型不能为primitive datatype,Primitive types such ascharcannot be
used as type parameters i...
分类:
其他好文 时间:
2014-05-09 09:19:01
阅读次数:
252