"For example, the standard io and os libraries don't work, but have been largely replaced by the NodeMCU node and file libraries."
But nowhere is it explained how to use file.write as an alternative for io.write.
A simple replacement of file.write for io.write yields:
PANIC: unprotected error in call to Lua API (calculateTime.lua:30: open a file first)
What file is to be opened to get the same serial console that is used by print()?
Where is this documented?