如何在lua中编写unicode符号

如何在lua中编写Unicode符号.例如,我必须用9658写符号
我写的时候
string.char( 9658 );

我收到了一个错误.那么如何编写这样的符号呢?

解决方法

Lua不看内部字符串.所以,你可以写
mychar = "►"

(2015年新增)

Lua 5.3引入了对UTF-8转义序列的支持

The UTF-8 encoding of a Unicode character can be inserted in a literal string with the escape sequence \u{XXX} (note the mandatory enclosing brackets),where XXX is a sequence of one or more hexadecimal digits representing the character code point.

你也可以使用utf8.char(9658).

相关文章

1.github代码实践源代码是lua脚本语言,下载th之后运行thmai...
此文为搬运帖,原帖地址https://www.cnblogs.com/zwywilliam/...
Rime输入法通过定义lua文件,可以实现获取当前时间日期的功能...
localfunctiongenerate_action(params)localscale_action=cc...
2022年1月11日13:57:45 官方:https://opm.openresty.org/官...
在Lua中的table(表),就像c#中的HashMap(哈希表),key和...