LUA script console - hint
Posted: Sun May 22, 2016 4:04 am
As well as using this to test your script snippets, leaving this open while testing events with LUA scripting is also useful.
Any print(..) statements you may have in the LAU action/trigger scripts should also print out in this window. This is very helpful when trying to debug why an event's script is not working - print out the variables, unit tables, etc.
However it is also a good idea to try to make the prints a bit verbose; a number on the screen does not say much.
eg: embedding this is in the event - print('MyEvent: random number = ' .. a) - would print out the value of 'a' during the 'MyEvent'.
I would also suggest commenting these lines out [add 2 dashes in front of it --print('MyEvent: random number = ' .. a)] before publishing to stop them from polluting the Console in case the player is also doing some in it.
I find commenting them out rather than deleting them, is more useful, as at some point you may need to go back to the script for some issue.[:D]
Any print(..) statements you may have in the LAU action/trigger scripts should also print out in this window. This is very helpful when trying to debug why an event's script is not working - print out the variables, unit tables, etc.
However it is also a good idea to try to make the prints a bit verbose; a number on the screen does not say much.
eg: embedding this is in the event - print('MyEvent: random number = ' .. a) - would print out the value of 'a' during the 'MyEvent'.
I would also suggest commenting these lines out [add 2 dashes in front of it --print('MyEvent: random number = ' .. a)] before publishing to stop them from polluting the Console in case the player is also doing some in it.
I find commenting them out rather than deleting them, is more useful, as at some point you may need to go back to the script for some issue.[:D]