From 4752c5ad2d849be2fc3e0984cac5828eeedc8220 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 8 Jun 2021 06:53:50 +0800 Subject: [PATCH] =?UTF-8?q?LOG.print=E4=BC=9A=E5=B0=9D=E8=AF=95=E6=8D=95?= =?UTF-8?q?=E8=8E=B7=E9=9D=9E=E6=B3=95utf8=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/log.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Zframework/log.lua b/Zframework/log.lua index fbe17e54..aa37a7e9 100644 --- a/Zframework/log.lua +++ b/Zframework/log.lua @@ -1,3 +1,4 @@ +local utf8=require"utf8" local gc=love.graphics local gc_setColor,gc_print=gc.setColor,gc.print local int,min=math.floor,math.min @@ -51,8 +52,10 @@ function LOG.print(text,T)--text,type/time elseif type(T)=='number'then time=T end - if his then ins(mesHistory,SCN.cur..": "..tostring(text))end - ins(mesList,{text=tostring(text),rgba={color[1],color[2],color[3],nil},blink=30,time=time or 120}) + text=tostring(text) + assert(utf8.len(text),"Error UTF-8 coding") + if his then ins(mesHistory,SCN.cur..": "..text)end + ins(mesList,{text=text,rgba={color[1],color[2],color[3],nil},blink=30,time=time or 120}) end function LOG.copy() love.system.setClipboardText(table.concat(mesHistory,"\n"))