ScriptCode is wrapped into a function by the LuaScript plugin e.g. if you enter
"print('hello world')" into a ScriptCode property, the plugin will convert it
to this internally:
function()
print('hello world')
end
If the ScriptCode property is on an event listener object (LuaLocalListener,
LuaGlobalListener) 2 parameters are added.
-
'this' is an IUserObject interface. Its value depends on the properties of the
Listener object. If the Listener::Type property is set to 'Class' and the
parent of the Listener is a class and the Listener::Source property is empty
then the 'this' parameter will be the object where the event originated (i.e.
event.obj). In all other cases 'this' will be the parent of the Listener
object.
-
'event' is the fragEvent structure that contains data about the event.
event.type tells you which member of the event contains the data (e.g. if
event.type == eventConstructor then event.construct will contain the data) It's
important to access the correct member of the event since the event uses a
union, other members may appear to be filled in but would contain invalid
values