I am trying to have a plugin with changeable display colours. I'm having a large problem with the colour changing script though, and I can't figure out why.
all the prints are just for debugging this odd problem. Here is what happens when it is run:
somehow colours[1] is showing up as nil when printed using the wildcard, but not when going through the pairs.
function ChangeColour( sTrig, sLine, wildcards )
print( wildcards[1].." "..wildcards[2] )
require "tprint"
tprint( colours )
tprint( colourcodes )
print( ( colours[ wildcards[1] ] or "nil" ).." "..( colourcodes[ wildcards[2] or "" ] or "nil" ) )
if colourcodes[ wildcards[2] ] ~= nil then
colours[ wildcards[1] ] = wildcards[2]
else
ColourNote( colourcodes[ "%W" ], "", wildcards[2].." is an invalid selection " )
end
end
all the prints are just for debugging this odd problem. Here is what happens when it is run:
1 @R
1="@G"
2="@W"
"@B"="#78BCFF"
"@C"="#5AFFFF"
"@m"="#BE32FF"
"@y"="#E3BF65"
"@W"="white"
"@M"="#FF5AFF"
"@b"="#5E5EFF"
"@c"="cyan"
"@R"="#FF5A5A"
"@G"="palegreen"
"@r"="red"
"@Y"="#FFFF5A"
"@w"="#E1E1E1"
"@g"="#2CCE2C"
nil #FF5A5A
somehow colours[1] is showing up as nil when printed using the wildcard, but not when going through the pairs.