This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
camadas's profile picture

colors.args[1] don't work, only colors.color

Started by camadas, 08 January 2014 - 01:09 PM
camadas #1
Posted 08 January 2014 - 02:09 PM
Hi.

I'm trying to create a function to work for all colors to see if the redstone of that color is active or not, so I have created this function.


function cor_ler(...)
   local args = {...}
   local cor = rs.testBundledInput("right", colors.args[1])
   return cor
end

On the code if i change the cor_ler(), put comment on local args and change the args[1] into orange, it will return as it should, but witht the actual code i get "red_status:3: attempt to index ? (a nil value).

If i make a


print(args[1])

it will show me the right name AKA orange on this case, so what I should do here ?
wieselkatze #2
Posted 08 January 2014 - 02:10 PM
That sould be colors[args[1]] else it would check for the first value in colors.args, which doesn't exist.
camadas #3
Posted 08 January 2014 - 02:31 PM
That sould be colors[args[1]] else it would check for the first value in colors.args, which doesn't exist.

Thanks :D/>