我有一个功能,允许我在一行中添加和删除字符,我想将其限制为大约 10 个字符
function love.keypressed(key, unicode)
if key == "backspace" or key == "delete" then
player = string.sub(player, 1, #player-1)
elseif unicode > 31 and unicode < 127 then
player = player .. string.char(unicode)
end
end