![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Ktotoetoia |
how can i do this with this code
var normal_char = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","0"]
func _on_LineEdit_text_entered(new_text):
if new_text != "":if !new_text in FS.level_names:
level_name = new_text
level_path = "res://saves/scene_saves/"+str(level_name)
$Label.text = level_name
$Label.visible = true
can_play = true
$LineEdit.queue_free()
FS.level_names += [level_name]
FS.save_data(level_name+".txt",FS.level_names)
when i use
if !new_text.find(normal_char) <=0:
it dont work
try
print(normal_char)
and
print(new_text)
ramazan | 2022-02-05 14:00
it prints:
!@#!@#
[a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
Ktotoetoia | 2022-02-05 14:23
print(new_text.find(normal_char))
ramazan | 2022-02-05 14:39
-1
but when i use
print(newtext.find("a"))
it prints correctly
Ktotoetoia | 2022-02-05 17:04