源码已经更新在优快云的码库里:
git clone https://gitcode.com/funsion/CLua.git
在src文件夹下的lstrlib.c 标准字符串操作与模式匹配库函数,表明这个C源文件实现了Lua的标准字符串操作与模式匹配库,即提供了与字符串操作相关的API和功能实现。
增加中文版stringmetamethods 元方法列表,保留英文版stringmetamethods元方法列表。
原始的代码为:
static const luaL_Reg stringmetamethods[] = {
{"__add", arith_add},
{"__sub", arith_sub},
{"__mul", arith_mul},
{"__mod", arith_mod},
{"__pow", arith_pow},
{"__div", arith_div},
{"__idiv", arith_idiv},
{"__unm", arith_unm},
{"__index", NULL}, /* placeholder */
{NULL, NULL}
};
更改成以下代码:
static const luaL_Reg stringmetamethods[] = {
{"__add", arith_add}, {"__加",arith_add},
{"__sub", arith_sub}, {"__减",arith_sub},
{"__mul", arith_mul}, {"__乘",arith_mul},
{"__mod", arith_mod}, {"__模",arith_mod},
{"__pow", arith_pow}, {"__幂",arith_pow},
{"__div", arith_div}, {"__除",arith_div},
{"__idiv", arith_idiv}, {"__整除",arith_idiv},
{"__unm", arith_unm}, {"__负",arith_unm},
{"__index", NULL}, {"__索引",NULL},
{NULL, NULL}
};
原始的代码为:
static const luaL_Reg strlib[] = {
{"byte", str_byte},
{"char", str_char},
{"dump", str_dump},
{"find", str_find},
{"format", str_format},
{"gmatch", gmatch},
{"gsub", str_gsub},
{"len", str_len},
{"lower", str_lower},
{"match", st

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



