找到如下内容
修改为下面代码,并保存。
default: { if (lislalpha(ls->current)|| ls->current >= 0x80) { /* identifier or reserved word? *///修改 TString *ts; do { if (ls->current >= 0x80) { //修改 save_and_next(ls); //修改 if(ls->current !='('&&ls->current >=0x80)//修改 save_and_next(ls); //修改 } else if(ls->current !='('){ //修改 save_and_next(ls); //修改 } } while (lislalnum(ls->current)|| ls->current >= 0x80);//修改 ts = luaX_newstring(ls, luaZ_buffer(ls->buff), luaZ_bufflen(ls->buff)); seminfo->ts = ts; if (isreserved(ts)) /* reserved word? */ return ts->extra - 1 + FIRST_RESERVED; else { return TK_NAME; } } else { /* single-char tokens (+ - / ...) */ int c = ls->current; next(ls); return c; }}
cd lua-5.3.4 #进入lua目录 make macosx test make install
cd lua-5.3.4 make linux test make install
ps.这样修改也支持中文函数名,网上修改的方法 function 跑()
运行会报错如下:
lua: 任务.lua:18: '(' expected near ')'
联系客服