PDA

View Full Version : LScript checking message sends in functions at compile-time


ardee
01-20-2005, 08:26 PM
LScript bails out on scripts wherein functions are calling methods on globals that, at the time of compilation, do not have a value that responds to the method. I think this is BAD. LScript is dynamically typed and this form of limited type checking is the wrong thing.

Example: Globals in modifiers are usually initialized within the "option" method. However, code like this is rejected:

GBone;
process: ChannelAccess, Time, Frame
{
RestPos = GBone.restParam( WPOSITION );
}
option:
{
//initialize GBone with a value set by the user through an interface
}

This bails with restParam being rejected as a valid method of GBone.

By the way, it's restParam and not restparam as claimed in the LW docs.

GregMalick
01-21-2005, 05:34 PM
Did you initialize GBone in your create() routine?
Otherwise the object is nil and does not have that method until the UI panel is brought up.

If you did initialize GBone, are you on 8.2
We are experiencing problems with Globals in 8.2 getting wiped out.

H2MW is on the case.

ardee
01-21-2005, 07:53 PM
Nope, that's the fault. Did not initialize GBone in create. So, been misled about this message checking stuff. Thanks for the help.