Script compatibility announcement (IF statement bugfix) - Script Writing - CHDK Forum

Script compatibility announcement (IF statement bugfix)

  • 0 Replies
  • 12385 Views
*

Offline fudgey

  • *****
  • 1705
  • a570is
Script compatibility announcement (IF statement bugfix)
« on: 24 / October / 2009, 06:31:10 »
Advertisements
Important script compatibility announcement:

A bug in IF statements will soon be fixed CHDK UBASIC. IF-THEN-ELSE statements should then work as they were meant to even when nested, but THIS FIX WILL BREAK SOME OLD SCRIPTS. Only UBASIC scripts (*.bas) are affected. Lua scripts (*.lua) are not affected in any way.

Details:

Most scripts will not be affected, but some of your scripts may stop working. Typically this is because they violate one of these rules (that have always been there):

- a single line IF-THEN-[ELSE] statement must not end with an ENDIF.
- in multi line statements IF-THEN, ELSE and ENDIF must each be on separate lines.

examples:

correct:
IF a>3 THEN b=1 ELSE b=0

wrong:
IF a>3 THEN b=1 ELSE b=0 ENDIF

correct:
IF a>3 THEN
  b=1
  c=1
ELSE
  b=0
ENDIF


Your script could also be exploiting (or working around) the bug in some perverse way that will no longer work.

For more information, see this thread: http://chdk.setepontos.com/index.php/topic,4276.0.html. A simple utility for checking your scripts is available at http://chdk.setepontos.com/index.php/topic,4276.msg40944.html#msg40944.  Please report any faulty scripts you find in that thread.

 

Related Topics