Not sure if this has been covered already here, but you can do this:
function MyCode()
if whatever then
LuaEvents:MyCustomEvent(param1, param2, whatever);
end
end
specifying your own event name and parameters.
Then elsewhere, when you want to respond to that event, you...