min() function anomalies

Shari shari at gypsyware.com
Wed Jun 13 18:20:23 EDT 2007


>Just for fun, an alternate method which never leaves trailing commas

I must be weird in my coding or something :-)

In another project, I have a variable that is constantly changing.

I chose to add to the variable with "put something & comma after 
myVariable" rather than putting the comma first, as putting the comma 
first creates the empty place at the beginning.

Either way, the comma becomes an issue.

If I add to the variable and immediately delete the trailing comma, 
the very next handler that runs will have to check for the comma 
anyway, and add it back in when it adds to the end of the variable. 
The variable is constantly being updated, both added to and deleted 
from.

Am I the only one who has variables with commas that constantly change?

The issue also exists with trailing returns... "put something & 
return after myVariable".  But if the variable is in constant flux, 
with things being added to or deleted from, then checking for the 
comma or return becomes an issue.

Case in point, Blackjack Gold keeping track of the chips.  Chips are 
coming and going literally with every single handler.  And one 
variable keeps track of all available chips (chip objects that are 
available for use, that aren't being used in the player's chip stacks 
or bet stacks).  This variable is updated constantly, every time a 
player loses a bet, colors up or down, or every time the dealer needs 
to pay out the winners.  It always uses the first chip, deletes it, 
and adds chips to the end of the variable.  Sometimes it needs to get 
more chips if it runs out of objects, creating new chip objects and 
adding them to the end of the variable.  So it constantly creates the 
trailing comma.  But if I delete it, it must constantly check to put 
it back in if it adds chips to the end of the variable, which is 
every time the dealer wins, which of course happens a lot :-)

This doesn't have anything specifically to do with the min() 
function, but the whole issue of trailing commas wreaking havoc.

Shari
-- 
Windows and Macintosh shareware games
BIackjack Gold
http://www.gypsyware.com



More information about the use-livecode mailing list