文本控件缺少文本时不会报错

This commit is contained in:
MrZ626
2020-11-08 19:18:22 +08:00
parent dea254f436
commit 9ad0b18473

View File

@@ -23,6 +23,10 @@ local text={
function text:reset()
if type(self.text)=="string"then
self.text=gc.newText(getFont(self.font),self.text)
elseif type(self.text)~="userdata"or self.text.type(self.text)~="Text"then
self.text=gc.newText(getFont(self.font),self.name)
self.color=COLOR.dPurple
self.font=self.font-10
end
end
function text:draw()