优化输入框删除文字逻辑
This commit is contained in:
@@ -761,10 +761,11 @@ function inputBox:keypress(k)
|
|||||||
local t=self.value
|
local t=self.value
|
||||||
if #t>0 and EDITING==""then
|
if #t>0 and EDITING==""then
|
||||||
if k=="backspace"then
|
if k=="backspace"then
|
||||||
while t:byte(#t)>=128 and t:byte(#t)<192 do
|
local p=#t
|
||||||
t=sub(t,1,-2)
|
while t:byte(p)>=128 and t:byte(p)<192 do
|
||||||
|
p=p-1
|
||||||
end
|
end
|
||||||
t=sub(t,1,-2)
|
t=sub(t,1,p-1)
|
||||||
SFX.play("lock")
|
SFX.play("lock")
|
||||||
elseif k=="delete"then
|
elseif k=="delete"then
|
||||||
t=""
|
t=""
|
||||||
|
|||||||
Reference in New Issue
Block a user