I want to know why there is a red underline, which usually means a error, is there when it does not need to because the code runs without any errors and works with what I have tried, the red underline just annoys me lol
the reason I am using this is to convert string values into Vector3 or CFrame’s because I cant get these from an animation:GetMarkerReached(“Marker”):Function(variable)
-- an example string
local example = "-1.76, 42, 0.53";
-- now we'll use gmatch to get the numbers:
local coord = {};
for num in string.gmatch(example, "[-%d%.]+") do --This line
-- travels from left to right, so x, then y, then z
table.insert(coord, tonumber(num));
end;
-- finally put into vector3 form
local v3 = Vector3.new(unpack(coord));
print(v3);
You forgot to define to LUA what the “-” is in your range within your iterator
You have the Orange line which means “Warning” not “Error”, warnings dont mean your script terminates or kills the thread.
You can define it for LUA by adding a “%” before the “-” in the iterator
local example = "-1.76, 42, 0.53";
local coord = {};
for num in string.gmatch(example, "[%-%d%.]+") do table.insert(coord, tonumber(num));
end;
local v3 = Vector3.new(unpack(coord));
print(typeof(v3));
print(v3);
Ive tested this and it returns the same exact results as if you didnt define the “-” in the iterator, this just annihilates the warning in the interpreter
Check here for a tutorial on vanilla LUAs string formats