From aa3826ed8d3ed629a6fb25fe822688a7cef29fe3 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Thu, 10 Dec 2020 14:15:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/text.lua | 29 ++++++++++++++--------------- Zframework/toolfunc.lua | 18 +++++++++--------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/Zframework/text.lua b/Zframework/text.lua index 93822804..f9b25ce8 100644 --- a/Zframework/text.lua +++ b/Zframework/text.lua @@ -1,6 +1,5 @@ local gc=love.graphics -local rnd=math.random -local rem=table.remove +local rnd,rem=math.random,table.remove local setFont,mStr=setFont,mStr local texts={} @@ -74,18 +73,6 @@ local TEXT={} function TEXT.clear() texts={} end -function TEXT.getText(text,x,y,font,style,spd,stop)--Another version of TEXT() - return{ - c=0, - text=text, - x=x or 0, - y=y or 0, - font=font or 40, - spd=(spd or 1)/60, - stop=stop, - draw=textFX[style]or assert(false,"unavailable type:"..style), - } -end function TEXT.show(text,x,y,font,style,spd,stop) texts[#texts+1]={ c=0, --Timer @@ -95,7 +82,19 @@ function TEXT.show(text,x,y,font,style,spd,stop) font=font or 40, --Font spd=(spd or 1)/60, --Timing speed(1=last 1 sec) stop=stop, --Stop time(sustained text) - draw=textFX[style]or assert(false,"unavailable type:"..style), --Draw method + draw=textFX[style]or error("unavailable type:"..style), --Draw method + } +end +function TEXT.getText(text,x,y,font,style,spd,stop)--Another version of TEXT.show(), but only return text object, need manual management + return{ + c=0, + text=text, + x=x or 0, + y=y or 0, + font=font or 40, + spd=(spd or 1)/60, + stop=stop, + draw=textFX[style]or error("unavailable type:"..style), } end function TEXT.update(list) diff --git a/Zframework/toolfunc.lua b/Zframework/toolfunc.lua index 9de13323..67648d47 100644 --- a/Zframework/toolfunc.lua +++ b/Zframework/toolfunc.lua @@ -152,14 +152,14 @@ do--dumpTable k=k.."=" end elseif T=="boolean"then k="["..k.."]=" - else assert(false,"Error key type!") + else error("Error key type!") end T=type(v) if T=="number"then v=tostring(v) elseif T=="string"then v="\""..v.."\"" elseif T=="table"then v=dumpTable(v,t+1) elseif T=="boolean"then v=tostring(v) - else assert(false,"Error data type!") + else error("Error data type!") end s=s..tabs[t]..k..v..",\n" end @@ -167,21 +167,21 @@ do--dumpTable end end do--json - -- + -- json.lua - -- + -- Copyright (c) 2020 rxi - -- + -- Permission is hereby granted, free of charge, to any person obtaining a copy of -- this software and associated documentation files (the "Software"), to deal in -- the Software without restriction, including without limitation the rights to -- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -- of the Software, and to permit persons to whom the Software is furnished to do -- so, subject to the following conditions: - -- + -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. - -- + -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -189,7 +189,7 @@ do--json -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. - -- + local char=string.char json = {} @@ -588,7 +588,7 @@ do--httpRequest & wsConnect end else local function noNetLib() - LOG.print("[NO NETlib]",5,COLOR.yellow) + LOG.print("[NO NETlib for "..SYSTEM.."]",5,COLOR.yellow) end httpRequest=noNetLib wsConnect=noNetLib