Hey developers, so I am developing an admin script and I have a command for changing the lighting ambient. The command is pretty simple, you just break the message up into 4 separate arguments, the first one being the command itself, the second one being the ‘R’ (Red) value, the third one being the ‘G’ (Green) value and the fourth one being the ‘B’ (Blue) value. And then you just check to make sure the RGB values are above 0 and less than 255 and then you are ready to go. However, I would like a system where instead of you doing 255 0 0 for example, you would instead do 255,0,0. I already have a system of removing commas in a single argument using gmatch, like seen here:
for _, arg in pairs(args) do
for s in arg:gmatch("[^,%s]+") do
--Code here...
end
end
But I would like to know how I could sort the three values into order, because breaking the arguments up won’t be enough, so how would I sort the args into the correct ‘RGB’ (1,2,3) order to assign the RGB value to the ambient property.
Sorry for any confusion, I can elaborate if needed.