Note that it only includes functionality to detect standard idiomatic function declarations (FunctionDeclaration in the parser API) of setup/draw. This means that the following sketch will be unmodified and work as intended:
function setup() { createCanvas(200, 200); }
However, the following will be wrapped in an implicit setup() function, and the user's setup() function will actually never be called:
var setup = function() { createCanvas(200, 200); };
I think this is OK for now, since all the p5 examples out there (and the p5 community in general) do things the idiomatic way. But we should probably file a bug for this limitation just in case. Filed as #36.
This fixes #31.
Note that it only includes functionality to detect standard idiomatic function declarations (
FunctionDeclaration
in the parser API) of setup/draw. This means that the following sketch will be unmodified and work as intended:However, the following will be wrapped in an implicit
setup()
function, and the user'ssetup()
function will actually never be called:I think this is OK for now, since all the p5 examples out there (and the p5 community in general) do things the idiomatic way.
But we should probably file a bug for this limitation just in case.Filed as #36.