TEMPEST.114 Posted November 30, 2022 Posted November 30, 2022 This is what's there right now: function makeColor(R, G, B) return R * 256 * 256 + G * 256 + B end Surely this is what it's supposed to be: function makeColor(R, G, B) return R * 256 + G * 256 + B * 256 end ?
TEMPEST.114 Posted November 30, 2022 Author Posted November 30, 2022 (edited) Actually isn't it completely redundant? function makeColor(R, G, B) return R * 256 * 256 + G * 256 + B end COLOR = { WHITE = makeColor(255, 255, 255), LIGHT_GRAY = makeColor(200, 200, 200), DARK_GRAY = makeColor(74, 74, 74), RED = makeColor(125, 75, 0), BLUE = makeColor(0, 75, 125), BLACK = makeColor(0, 0, 0) } The whole point of that function is to turn a floating point number into a valid RGB value. But you're providing actual RGB non float integer values. So what's the point of it at all? Edited November 30, 2022 by Elphaba
Solution scoobie Posted November 30, 2022 Solution Posted November 30, 2022 I'm not sure what you mean. They're just throwing each basic colour (values 0..255) onto its appropriate byte in a number (B lowest, G next, R highest), like this (apostrophes separate bytes for clarity, each character is a bit): RRRRRRRR'GGGGGGGG'BBBBBBBB However... this is not a normal language, but this Lua thing, so the little code can as well launch a space probe to the orbit or do laundry for aunt Helen, no one knows 1 i7-8700K 32GB 3060Ti 27"@1080p TM Hawg HOTAS TPR TIR5 SD-XL 2xSD+ HC Bravo button/pot box
draconus Posted December 1, 2022 Posted December 1, 2022 11 hours ago, Elphaba said: Surely this is what it's supposed to be You don't assume if the code is right not knowing the rest of the program. Win10 i7-10700KF 32GB RTX4070S Quest 3 T16000M VPC CDT-VMAX TFRP FC3 F-14A/B F-15E CA SC NTTR PG Syria
Recommended Posts