Hi,

in your second example you're assigning to onItemUpdate a value that at that moment is undefined, that's why it does not work.
Each <script> element is executed as soon as it is parsed; note that during the parsing phase functions inside the element are created, that's why the first example correctly work even if formatValue is declared below the piece of code that "uses" it (table.onChangingValues = formatValues; )

There are several ways you can rewrite the code to let it work, just be sure that when you use something it already exists;
e.g.: you may include the format.js above the "new OverwriteTable" code.

HTH