# Custom Code

Lucid provides many actions, and will provide many more as time goes on. However, there will always be a point for advanced users where you may wish to insert your own code which Lucid does not provide actions for, to this end, Lucid has an Action available to easily insert your own custom code.

To insert custom code, choose 'Custom Code' from the 'Logic' menu. This will insert a Custom Code action into your Javascript. Yoy may double click this action, and you will see some code to show an alert window. You may remove this code and enter any code you wish. Your custom code will be encapsulated in a function which recieves two arguments, senderObject and event. You may manipulate these two arguments/objects and use them to call other custom code items, or other Lucid actions. This means that you can use custom code, and then re-enter your Lucid workflow.

When you insert a Custom Code action, like most other actions, it receives the parameters of 'senderObject' and 'event'. The senderObject is the object from where the event originally came, and the event contains a wealth of information about how the event happened ('click', 'hover', 'onload', etc.). It's also possible that the event has been manipulated or had properties added before it reaches the Custom Code action. For example, a Google Map action can place a map object into the event for later use. Custom Code actions are ideal for accessing JavaScript code created outside of Lucid, or for accessing jQuery functions not implemented within Lucid.

Note: If you enter syntactically incorrect Javascript code, you may cause your entire Lucid Javascript structure to stop working. If this happens, you may go into 'Preview' code, press the 'Debug' button and choose 'Console' to see any error messages that may have been logged.