So there is my code:
Code: Select all
function cleanname(name) --cleans the name from the numbers with returning the right one
local name = name
if string.find(name, "custom-belt") then
return "custom-belt"
end
if string.find(name, "custom-underground-belt") then
return "custom-underground-belt"
end
if string.find(name, "custom-splitter") then
return "custom-splitter"
end
print("log","name: ", name)
return nil
end
Code: Select all
log name: custom-belt
edit: I actually found the problem. It does not work, when the string and the pattern are the same. so because both was custom-belt it didn't work. But just belt work's. a little confusing.