用户登录
用户注册

分享至

Lua中..和#运算符的使用方法

  • 作者: 嘟嘟34268323
  • 来源: 51数据库
  • 2021-08-21

通过lua语言支持其他运算符包括串联和长度。

 例子

试试下面的例子就明白了在lua编程语言提供的其他运算符:

复制代码 代码如下:
a = "hello "
b = "world"

print("concatenation of string a with b is ", a..b )

print("length of b is ",#b )

print("length of b is ",#"test" )

当建立并执行上面的程序它会产生以下结果:

复制代码 代码如下:
concatenation of string a with b is  hello world
length of b is  5
length of b is  4

软件
前端设计
程序设计
Java相关