Difference between revisions of "Talk:LlGetSunDirection"

From Second Life Wiki
Jump to navigation Jump to search
m
Line 9: Line 9:
--[[User:Francoise Eichel|Francoise Eichel]] 04:40, 14 May 2009 (UTC)
--[[User:Francoise Eichel|Francoise Eichel]] 04:40, 14 May 2009 (UTC)


:lightsOn isn't labeled as nor is it FALSE, it is labeled as being neither TRUE or FALSE. When the code runs, -1 won't match either the TRUE or FALSE value from the elevation test; which will result in it setting the fullbright attributes of the faces. Your proposed change of comment does not match how the works. I think you are confused by the mix of Boolean keywords with integer types, LSL doesn't have a dedicated Boolean type and does not have Boolean compares, it uses integer compares instead (which is what the code takes advantage of). -- '''[[User:Strife_Onizuka|Strife]]''' <sup><small>([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])</small></sup> 10:30, 14 May 2009 (UTC)
:lightsOn isn't labeled as nor is it FALSE, it is labeled as being neither TRUE or FALSE. When the code runs, -1 won't match either the TRUE or FALSE value from the elevation test; which will result in it setting the fullbright attributes of the faces. Your proposed change of comment does not match how the code works. I think you are confused by the mix of Boolean keywords with integer types, LSL doesn't have a dedicated Boolean type and does not have Boolean compares, it uses integer compares instead (which is what the code exploits). -- '''[[User:Strife_Onizuka|Strife]]''' <sup><small>([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])</small></sup> 10:30, 14 May 2009 (UTC)

Revision as of 05:47, 14 May 2009

In the first example to "quickly determine whether it is day or night" you see the first line read as :

integer lightsOn = -1;//not TRUE or FALSE

I think its a very bad idea to label -1 as FALSE in capital in the comment, since FALSE is 0 in LSL and in most if not all programming languages

the comment should simply read "// assume lights off on start", this would be clear and wouldn't require any modification to the code

--Francoise Eichel 04:40, 14 May 2009 (UTC)

lightsOn isn't labeled as nor is it FALSE, it is labeled as being neither TRUE or FALSE. When the code runs, -1 won't match either the TRUE or FALSE value from the elevation test; which will result in it setting the fullbright attributes of the faces. Your proposed change of comment does not match how the code works. I think you are confused by the mix of Boolean keywords with integer types, LSL doesn't have a dedicated Boolean type and does not have Boolean compares, it uses integer compares instead (which is what the code exploits). -- Strife (talk|contribs) 10:30, 14 May 2009 (UTC)