|
|||||||||||||||||||||||||||||
|
|
This should be placed in a moviescript. To use place script in a movieScript and call from anywhere, such as the message window. You can either pass the month and year or just the month... which will assume the current year. One big thing to note is that the code is much more than you would normally need to do the job. Here's the code you would normally need: on daysInMonth(theMonth, theYear) return date(theYear, theMonth + 1, 1) - date(theYear, theMonth, 1) end However, this is a bit inflexible... let's say I don't want to provide the year or maybe I want to provide the name of the month rather than the month number... or even the abbreviated name of the month... all of that is possible with the first custom handler. All that being said, here are some of the parameters that can be passed: -- from the message window if the code is placed in a moviescript put daysInMonth(12, 2005) -- 31 put daysInMonth(11) -- 30 put daysInMonth("February") -- 28 put daysInMonth("feb") -- 28 put daysInMonth("Feb") -- 28 Actually, this behavior is a good example of how to use the findPosNear() function for lists as well as allowing for different data types and numbers of parameters to be passed to a function.
|
|
|