Parcourir la source

Simplified Script::Scope to only support GLOBAL and PROTECTED modes.
ScriptTargets now only support loading scripts via the PROTECTED scope.
Global scripts can still be loaded via ScriptController::loadScript, or by using the old game.config "scripts" namespace.

sgrenier il y a 11 ans
Parent
commit
6765bb6c07
43 fichiers modifiés avec 998 ajouts et 798 suppressions
  1. 1 1
      gameplay/src/Control.cpp
  2. 2 4
      gameplay/src/Game.cpp
  3. 1 1
      gameplay/src/SceneLoader.cpp
  4. 10 20
      gameplay/src/Script.h
  5. 5 5
      gameplay/src/ScriptController.cpp
  6. 5 6
      gameplay/src/ScriptController.h
  7. 16 17
      gameplay/src/ScriptTarget.cpp
  8. 22 11
      gameplay/src/ScriptTarget.h
  9. 54 43
      gameplay/src/lua/lua_AnimationClip.cpp
  10. 1 0
      gameplay/src/lua/lua_AnimationClip.h
  11. 54 43
      gameplay/src/lua/lua_Button.cpp
  12. 1 0
      gameplay/src/lua/lua_Button.h
  13. 54 43
      gameplay/src/lua/lua_CheckBox.cpp
  14. 1 0
      gameplay/src/lua/lua_CheckBox.h
  15. 54 43
      gameplay/src/lua/lua_Container.cpp
  16. 1 0
      gameplay/src/lua/lua_Container.h
  17. 54 43
      gameplay/src/lua/lua_Control.cpp
  18. 1 0
      gameplay/src/lua/lua_Control.h
  19. 54 43
      gameplay/src/lua/lua_Form.cpp
  20. 1 0
      gameplay/src/lua/lua_Form.h
  21. 1 2
      gameplay/src/lua/lua_Global.cpp
  22. 54 43
      gameplay/src/lua/lua_ImageControl.cpp
  23. 1 0
      gameplay/src/lua/lua_ImageControl.h
  24. 54 43
      gameplay/src/lua/lua_Joint.cpp
  25. 1 0
      gameplay/src/lua/lua_Joint.h
  26. 54 43
      gameplay/src/lua/lua_JoystickControl.cpp
  27. 1 0
      gameplay/src/lua/lua_JoystickControl.h
  28. 54 43
      gameplay/src/lua/lua_Label.cpp
  29. 1 0
      gameplay/src/lua/lua_Label.h
  30. 54 43
      gameplay/src/lua/lua_Node.cpp
  31. 1 0
      gameplay/src/lua/lua_Node.h
  32. 54 43
      gameplay/src/lua/lua_PhysicsController.cpp
  33. 1 0
      gameplay/src/lua/lua_PhysicsController.h
  34. 54 43
      gameplay/src/lua/lua_RadioButton.cpp
  35. 1 0
      gameplay/src/lua/lua_RadioButton.h
  36. 54 43
      gameplay/src/lua/lua_ScriptTarget.cpp
  37. 1 0
      gameplay/src/lua/lua_ScriptTarget.h
  38. 54 43
      gameplay/src/lua/lua_Slider.cpp
  39. 1 0
      gameplay/src/lua/lua_Slider.h
  40. 54 43
      gameplay/src/lua/lua_TextBox.cpp
  41. 1 0
      gameplay/src/lua/lua_TextBox.h
  42. 54 43
      gameplay/src/lua/lua_Transform.cpp
  43. 1 0
      gameplay/src/lua/lua_Transform.h

+ 1 - 1
gameplay/src/Control.cpp

@@ -238,7 +238,7 @@ void Control::initialize(const char* typeName, Theme::Style* style, Properties*
 
 		// Register script listeners for control events
 		if (properties->exists("script"))
-			addScript(properties->getString("script"), Script::PRIVATE_INSTANCE);
+			addScript(properties->getString("script"));
 
 		// Potentially override themed properties for all states.
 		overrideThemedProperties(properties, STATE_ALL);

+ 2 - 4
gameplay/src/Game.cpp

@@ -187,14 +187,12 @@ bool Game::startup()
         const char* scriptPath = _properties->getString("script");
         if (scriptPath)
         {
-            // TODO: Should we support specifying scope for the Game script, to support
-            // non-global Game scripts?
             _scriptTarget = new GameScriptTarget();
-            _scriptTarget->addScript(scriptPath, Script::GLOBAL);
+            _scriptTarget->addScript(scriptPath);
         }
         else
         {
-            // Use the older scripts namespace for loading individual script callback functions
+            // Use the older scripts namespace for loading individual global script callback functions.
             Properties* sns = _properties->getNamespace("scripts", true);
             if (sns)
             {

+ 1 - 1
gameplay/src/SceneLoader.cpp

@@ -403,7 +403,7 @@ void SceneLoader::applyNodeProperty(SceneNode& sceneNode, Node* node, const Prop
             break;
         }
         case SceneNodeProperty::SCRIPT:
-            node->addScript(snp._value.c_str(), Script::PRIVATE_INSTANCE);
+            node->addScript(snp._value.c_str());
             break;
         default:
             GP_ERROR("Unsupported node property type (%d).", snp._type);

+ 10 - 20
gameplay/src/Script.h

@@ -34,34 +34,24 @@ public:
         GLOBAL,
 
         /**
-         * Private scripts execute in a more limited sandbox environment that by default does
-         * not  allow other scripts to see their variables or functions. Variables and functions
-         * in a private script can be named the same as those in other scripts without 
+         * Protected scripts execute in a more limited sandbox environment that by default does
+         * not allow other scripts to see their variables or functions. Variables and functions
+         * in a protected script can be named the same as those in other scripts without 
          * collision issues.
          *
-         * Although global code cannot access private scripts, private scripts can acceess
-         * global code. Similarly, private scripts can expose variables and functions to the
+         * Although global code cannot access protected scripts, protected scripts can acceess
+         * global code. Similarly, protected scripts can expose variables and functions to the
          * global environment using explicit notation, although the same precautions noted
          * for the GLOBAL scope should be used when doing this, to prevent naming collisions.
          *
-         * PRIVATE_SHARED scripts can have at most once instance of the script loaded into
-         * memory, with all objects referencing the script sharing it. This means that shared
-         * scripts may execute for multiple objects and therefore do not have any instance 
-         * information available to them other than what is passed through function callbacks.
-         * Similarly, shared scripts should not attempt to store any per-instance state.
-         */
-        PRIVATE_SHARED,
-
-        /**
-         * PRIVATE_INSTANCE scripts provide the same sandboxed envrionment that PRIVATE_SHARED
-         * scripts do. However, there may be multiple instances of the same PRIVATE_INSTANCE
-         * script loaded into memory at the same time: one for each object that references it.
-         * Because of this, instance scripts can be used to store per-instance state, since it
-         * will not be shared by multiple instances.
+         * Protected scripts are best used when associated with a single game object, since
+         * these scripts are not cached the same way global scripts are. Each time a protected
+         * script is loaded, a new instance of the script is loaded. This allows protected 
+         * scripts to store per-instance state, since it will not be shared by multiple instances.
          *
          * @see ScriptTarget
          */
-        PRIVATE_INSTANCE
+        PROTECTED
     };
 
     /**

+ 5 - 5
gameplay/src/ScriptController.cpp

@@ -161,9 +161,9 @@ Script* ScriptController::loadScript(const char* path, Script::Scope scope, bool
 
     Script* script = NULL;
 
-    // For single-instance scripts (GLOBAL and PRIVATE_SHARED), check if a script with the same
-    // path and scope is already loaded. PRIVATE_INSTANCE scripts are always reloaded.
-    if (scope == Script::GLOBAL || scope == Script::PRIVATE_SHARED)
+    // For global scripts, check if a script with the same path and scope is already loaded.
+    // Protected scripts are always loaded into a new instance.
+    if (scope == Script::GLOBAL)
     {
         std::map<std::string, std::vector<Script*>>::iterator itr = _scripts.find(path);
         if (itr != _scripts.end())
@@ -228,9 +228,9 @@ bool ScriptController::loadScript(Script* script)
 
     if (ret == LUA_OK)
     {
-        // If the requested scope is private, create a new script env table to execute
+        // If the requested scope is protected, create a new script env table to execute
         // the script within, using a metatable to fallback to the global table (_G)
-        if (script->_scope != Script::GLOBAL)
+        if (script->_scope == Script::PROTECTED)
         {
             // Create a new table as an environment for the new script
             lua_newtable(_lua); // new ENV for script [chunk, env]

+ 5 - 6
gameplay/src/ScriptController.h

@@ -25,16 +25,15 @@ public:
      * Loads the given script file and executes its code (if it is not
      * alreay loaded).
      *
-     * The script is loaded into an environment that is defined by the scope 
-     * parameter. If the script scope is GLOBAL or PRIVATE_SHARED and if the
-     * forceReload parameter is false, a previously-loaded script object may
-     * be returned. PRIVATE_INSTANCE scope always results in a new script being
-     * loaded and executed.
+     * The script is loaded into an environment that is defined by the scope parameter.
+     * If the script scope is GLOBAL and the forceReload parameter is false, a
+     * previously-loaded script object may be returned. PROTECTED scope always results
+     * in a new script being loaded and executed.
      * 
      * @param path The path to the script.
      * @param scope The scope for the script to be executed in.
      * @param forceReload Whether the script should be reloaded if it has already been loaded
-     *      (applicable for GLOBAL and PRIVATE_SHARED scripts only).
+     *      (applicable for GLOBAL scripts only).
      *
      * @return The loaded script, or NULL if the script could not be loaded.
      */

+ 16 - 17
gameplay/src/ScriptTarget.cpp

@@ -122,12 +122,12 @@ void ScriptTarget::registerEvents(EventRegistry* registry)
     }
 }
 
-Script* ScriptTarget::addScript(const char* path, Script::Scope scope)
+Script* ScriptTarget::addScript(const char* path)
 {
     ScriptController* sc = Game::getInstance()->getScriptController();
 
     // Load the script
-    Script* script = sc->loadScript(path, scope);
+    Script* script = sc->loadScript(path, Script::PROTECTED);
     if (!script)
         return NULL;
 
@@ -165,29 +165,25 @@ Script* ScriptTarget::addScript(const char* path, Script::Scope scope)
         re = re->next;
     }
 
-    // For non-global scripts, automatically call the 'attached' event if it is defined
-    // within the script
-    if (scope != Script::GLOBAL)
+    // Automatically call the 'attached' event if it is defined within the script
+    if (sc->functionExists("attached", script))
     {
-        if (sc->functionExists("attached", script))
-        {
-            char args[256];
-            sprintf(args, "<%s>", getTypeName());
-            sc->executeFunction<void>(script, "attached", args, dynamic_cast<void*>(this));
-        }
+        char args[256];
+        sprintf(args, "<%s>", getTypeName());
+        sc->executeFunction<void>(script, "attached", args, dynamic_cast<void*>(this));
     }
 
     return script;
 }
 
-bool ScriptTarget::removeScript(const char* path, Script::Scope scope)
+bool ScriptTarget::removeScript(const char* path)
 {
     GP_ASSERT(path);
 
     ScriptEntry* se = _scripts;
     while (se)
     {
-        if (strcmp(se->script->getPath(), path) == 0 && scope == se->script->getScope())
+        if (strcmp(se->script->getPath(), path) == 0 && se->script->getScope() == Script::PROTECTED)
         {
             removeScript(se);
             return true;
@@ -382,6 +378,12 @@ void ScriptTarget::clearScripts()
 }
 
 bool ScriptTarget::hasScriptListener(const char* eventName) const
+{
+    const Event* event = getScriptEvent(eventName);
+    return event ? hasScriptListener(event) : false;
+}
+
+const ScriptTarget::Event* ScriptTarget::getScriptEvent(const char* eventName) const
 {
     GP_ASSERT(eventName);
 
@@ -395,10 +397,7 @@ bool ScriptTarget::hasScriptListener(const char* eventName) const
         re = re->next;
     }
 
-    if (event == NULL)
-        return false;
-
-    return hasScriptListener(event);
+    return event;
 }
 
 bool ScriptTarget::hasScriptListener(const Event* event) const

+ 22 - 11
gameplay/src/ScriptTarget.h

@@ -102,9 +102,9 @@ public: \
  * registered ScriptTarget::Event object and any required parameters.
  *
  * In addition to script events that are explicitly defined by a custom ScriptTarget class,
- * all ScriptTarget scripts that execute within a non-global scope also implicitly
- * support an "attached" event. This event is called immediately after such a script is 
- * attached to a ScriptTarget and it takes a single parameter: the ScriptTarget object.
+ * all ScriptTarget scripts implicitly support an "attached" event. This event is called
+ * immediately after such a script is attached to a ScriptTarget and it takes a single
+ * parameter: the ScriptTarget object.
  */
 class ScriptTarget
 {
@@ -227,30 +227,32 @@ public:
     /**
      * Attaches a script to this object.
      *
-     * By default, scripts are added using the PRIVATE_INSTANCE scope, which
-     * loads scripts into their own private script environment, allowing
-     * variables with the same name to be used without trampling on other 
-     * scripts.
+     * Scripts attached to a ScriptTarget are loaded using the PROTECTED scope,
+     * which loads scripts into their own protected script environment, allowing
+     * variables with the same name to be used without colliding with other scripts.
      *
      * @param path Path to the script.
-     * @param scope Optional scope for the script (default is PRIVATE_INSTANCE).
      *
      * @return A pointer to the successfully loaded script, or NULL if unsuccessful.
      */
-    Script* addScript(const char* path, Script::Scope scope = Script::PRIVATE_INSTANCE);
+    Script* addScript(const char* path);
 
     /**
      * Removes a previously attached script from this object.
      *
      * @param path The same path that was used to load the script being removed.
-     * @param scope The same scope that was used to load the script being removed.
      *
      * @return True if a script is successfully removed, false otherwise.
      */
-    bool removeScript(const char* path, Script::Scope scope);
+    bool removeScript(const char* path);
 
     /**
      * Adds the given global script function as a callback for the given event.
+     *
+     * Individual script callback events registered via this method are expected
+     * to be global script functions. Registering individual callbacks in this
+     * manner is generally slower than registering a single script to handle script
+     * events for an object.
      * 
      * @param event The event to add the callback for.
      * @param function The name of the script function to call when the event is fired; can either be
@@ -292,6 +294,15 @@ public:
      */
     bool hasScriptListener(const Event* event) const;
 
+    /**
+     * Returns the event object for the given event name, if it exists.
+     *
+     * @param eventName Name of the event.
+     *
+     * @return The event object for the given name, or NULL if no such event exists.
+     */
+    const Event* getScriptEvent(const char* eventName) const;
+
     /**
      * Fires the specified script event, passing the specified arguments.
      *

+ 54 - 43
gameplay/src/lua/lua_AnimationClip.cpp

@@ -37,6 +37,7 @@ void luaRegister_AnimationClip()
         {"getLoopBlendTime", lua_AnimationClip_getLoopBlendTime},
         {"getRefCount", lua_AnimationClip_getRefCount},
         {"getRepeatCount", lua_AnimationClip_getRepeatCount},
+        {"getScriptEvent", lua_AnimationClip_getScriptEvent},
         {"getSpeed", lua_AnimationClip_getSpeed},
         {"getStartTime", lua_AnimationClip_getStartTime},
         {"getTypeName", lua_AnimationClip_getTypeName},
@@ -313,43 +314,9 @@ int lua_AnimationClip_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                AnimationClip* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_AnimationClip_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -840,6 +807,54 @@ int lua_AnimationClip_getRepeatCount(lua_State* state)
     return 0;
 }
 
+int lua_AnimationClip_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                AnimationClip* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_AnimationClip_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_AnimationClip_getSpeed(lua_State* state)
 {
     // Get the number of parameters.
@@ -1277,20 +1292,16 @@ int lua_AnimationClip_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 AnimationClip* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -1304,7 +1315,7 @@ int lua_AnimationClip_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_AnimationClip.h

@@ -25,6 +25,7 @@ int lua_AnimationClip_getId(lua_State* state);
 int lua_AnimationClip_getLoopBlendTime(lua_State* state);
 int lua_AnimationClip_getRefCount(lua_State* state);
 int lua_AnimationClip_getRepeatCount(lua_State* state);
+int lua_AnimationClip_getScriptEvent(lua_State* state);
 int lua_AnimationClip_getSpeed(lua_State* state);
 int lua_AnimationClip_getStartTime(lua_State* state);
 int lua_AnimationClip_getTypeName(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_Button.cpp

@@ -61,6 +61,7 @@ void luaRegister_Button()
         {"getPadding", lua_Button_getPadding},
         {"getParent", lua_Button_getParent},
         {"getRefCount", lua_Button_getRefCount},
+        {"getScriptEvent", lua_Button_getScriptEvent},
         {"getSkinColor", lua_Button_getSkinColor},
         {"getSkinRegion", lua_Button_getSkinRegion},
         {"getState", lua_Button_getState},
@@ -306,43 +307,9 @@ int lua_Button_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                Button* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Button_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -2124,6 +2091,54 @@ int lua_Button_getRefCount(lua_State* state)
     return 0;
 }
 
+int lua_Button_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                Button* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Button_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Button_getSkinColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -3340,20 +3355,16 @@ int lua_Button_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 Button* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3367,7 +3378,7 @@ int lua_Button_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_Button.h

@@ -44,6 +44,7 @@ int lua_Button_getOpacity(lua_State* state);
 int lua_Button_getPadding(lua_State* state);
 int lua_Button_getParent(lua_State* state);
 int lua_Button_getRefCount(lua_State* state);
+int lua_Button_getScriptEvent(lua_State* state);
 int lua_Button_getSkinColor(lua_State* state);
 int lua_Button_getSkinRegion(lua_State* state);
 int lua_Button_getState(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_CheckBox.cpp

@@ -62,6 +62,7 @@ void luaRegister_CheckBox()
         {"getPadding", lua_CheckBox_getPadding},
         {"getParent", lua_CheckBox_getParent},
         {"getRefCount", lua_CheckBox_getRefCount},
+        {"getScriptEvent", lua_CheckBox_getScriptEvent},
         {"getSkinColor", lua_CheckBox_getSkinColor},
         {"getSkinRegion", lua_CheckBox_getSkinRegion},
         {"getState", lua_CheckBox_getState},
@@ -310,43 +311,9 @@ int lua_CheckBox_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                CheckBox* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_CheckBox_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -2128,6 +2095,54 @@ int lua_CheckBox_getRefCount(lua_State* state)
     return 0;
 }
 
+int lua_CheckBox_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                CheckBox* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_CheckBox_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_CheckBox_getSkinColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -3414,20 +3429,16 @@ int lua_CheckBox_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 CheckBox* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3441,7 +3452,7 @@ int lua_CheckBox_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_CheckBox.h

@@ -44,6 +44,7 @@ int lua_CheckBox_getOpacity(lua_State* state);
 int lua_CheckBox_getPadding(lua_State* state);
 int lua_CheckBox_getParent(lua_State* state);
 int lua_CheckBox_getRefCount(lua_State* state);
+int lua_CheckBox_getScriptEvent(lua_State* state);
 int lua_CheckBox_getSkinColor(lua_State* state);
 int lua_CheckBox_getSkinRegion(lua_State* state);
 int lua_CheckBox_getState(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_Container.cpp

@@ -77,6 +77,7 @@ void luaRegister_Container()
         {"getPadding", lua_Container_getPadding},
         {"getParent", lua_Container_getParent},
         {"getRefCount", lua_Container_getRefCount},
+        {"getScriptEvent", lua_Container_getScriptEvent},
         {"getScroll", lua_Container_getScroll},
         {"getScrollPosition", lua_Container_getScrollPosition},
         {"getScrollWheelRequiresFocus", lua_Container_getScrollWheelRequiresFocus},
@@ -387,43 +388,9 @@ int lua_Container_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                Container* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Container_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -2406,6 +2373,54 @@ int lua_Container_getRefCount(lua_State* state)
     return 0;
 }
 
+int lua_Container_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                Container* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Container_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Container_getScroll(lua_State* state)
 {
     // Get the number of parameters.
@@ -4068,20 +4083,16 @@ int lua_Container_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 Container* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -4095,7 +4106,7 @@ int lua_Container_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_Container.h

@@ -49,6 +49,7 @@ int lua_Container_getOpacity(lua_State* state);
 int lua_Container_getPadding(lua_State* state);
 int lua_Container_getParent(lua_State* state);
 int lua_Container_getRefCount(lua_State* state);
+int lua_Container_getScriptEvent(lua_State* state);
 int lua_Container_getScroll(lua_State* state);
 int lua_Container_getScrollPosition(lua_State* state);
 int lua_Container_getScrollWheelRequiresFocus(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_Control.cpp

@@ -58,6 +58,7 @@ void luaRegister_Control()
         {"getPadding", lua_Control_getPadding},
         {"getParent", lua_Control_getParent},
         {"getRefCount", lua_Control_getRefCount},
+        {"getScriptEvent", lua_Control_getScriptEvent},
         {"getSkinColor", lua_Control_getSkinColor},
         {"getSkinRegion", lua_Control_getSkinRegion},
         {"getState", lua_Control_getState},
@@ -301,43 +302,9 @@ int lua_Control_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                Control* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Control_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -2119,6 +2086,54 @@ int lua_Control_getRefCount(lua_State* state)
     return 0;
 }
 
+int lua_Control_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                Control* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Control_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Control_getSkinColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -3335,20 +3350,16 @@ int lua_Control_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 Control* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3362,7 +3373,7 @@ int lua_Control_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_Control.h

@@ -44,6 +44,7 @@ int lua_Control_getOpacity(lua_State* state);
 int lua_Control_getPadding(lua_State* state);
 int lua_Control_getParent(lua_State* state);
 int lua_Control_getRefCount(lua_State* state);
+int lua_Control_getScriptEvent(lua_State* state);
 int lua_Control_getSkinColor(lua_State* state);
 int lua_Control_getSkinRegion(lua_State* state);
 int lua_Control_getState(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_Form.cpp

@@ -79,6 +79,7 @@ void luaRegister_Form()
         {"getPadding", lua_Form_getPadding},
         {"getParent", lua_Form_getParent},
         {"getRefCount", lua_Form_getRefCount},
+        {"getScriptEvent", lua_Form_getScriptEvent},
         {"getScroll", lua_Form_getScroll},
         {"getScrollPosition", lua_Form_getScrollPosition},
         {"getScrollWheelRequiresFocus", lua_Form_getScrollWheelRequiresFocus},
@@ -397,43 +398,9 @@ int lua_Form_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                Form* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Form_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -2451,6 +2418,54 @@ int lua_Form_getRefCount(lua_State* state)
     return 0;
 }
 
+int lua_Form_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                Form* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Form_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Form_getScroll(lua_State* state)
 {
     // Get the number of parameters.
@@ -4148,20 +4163,16 @@ int lua_Form_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 Form* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -4175,7 +4186,7 @@ int lua_Form_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_Form.h

@@ -50,6 +50,7 @@ int lua_Form_getOpacity(lua_State* state);
 int lua_Form_getPadding(lua_State* state);
 int lua_Form_getParent(lua_State* state);
 int lua_Form_getRefCount(lua_State* state);
+int lua_Form_getScriptEvent(lua_State* state);
 int lua_Form_getScroll(lua_State* state);
 int lua_Form_getScrollPosition(lua_State* state);
 int lua_Form_getScrollWheelRequiresFocus(lua_State* state);

+ 1 - 2
gameplay/src/lua/lua_Global.cpp

@@ -882,8 +882,7 @@ void luaRegister_lua_Global()
         std::vector<std::string> scopePath;
         scopePath.push_back("Script");
         gameplay::ScriptUtil::registerEnumValue(Script::GLOBAL, "GLOBAL", scopePath);
-        gameplay::ScriptUtil::registerEnumValue(Script::PRIVATE_SHARED, "PRIVATE_SHARED", scopePath);
-        gameplay::ScriptUtil::registerEnumValue(Script::PRIVATE_INSTANCE, "PRIVATE_INSTANCE", scopePath);
+        gameplay::ScriptUtil::registerEnumValue(Script::PROTECTED, "PROTECTED", scopePath);
     }
 
     // Register enumeration Terrain::Flags.

+ 54 - 43
gameplay/src/lua/lua_ImageControl.cpp

@@ -61,6 +61,7 @@ void luaRegister_ImageControl()
         {"getRefCount", lua_ImageControl_getRefCount},
         {"getRegionDst", lua_ImageControl_getRegionDst},
         {"getRegionSrc", lua_ImageControl_getRegionSrc},
+        {"getScriptEvent", lua_ImageControl_getScriptEvent},
         {"getSkinColor", lua_ImageControl_getSkinColor},
         {"getSkinRegion", lua_ImageControl_getSkinRegion},
         {"getState", lua_ImageControl_getState},
@@ -308,43 +309,9 @@ int lua_ImageControl_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                ImageControl* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_ImageControl_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -2214,6 +2181,54 @@ int lua_ImageControl_getRegionSrc(lua_State* state)
     return 0;
 }
 
+int lua_ImageControl_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                ImageControl* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_ImageControl_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_ImageControl_getSkinColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -3430,20 +3445,16 @@ int lua_ImageControl_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 ImageControl* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3457,7 +3468,7 @@ int lua_ImageControl_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_ImageControl.h

@@ -46,6 +46,7 @@ int lua_ImageControl_getParent(lua_State* state);
 int lua_ImageControl_getRefCount(lua_State* state);
 int lua_ImageControl_getRegionDst(lua_State* state);
 int lua_ImageControl_getRegionSrc(lua_State* state);
+int lua_ImageControl_getScriptEvent(lua_State* state);
 int lua_ImageControl_getSkinColor(lua_State* state);
 int lua_ImageControl_getSkinRegion(lua_State* state);
 int lua_ImageControl_getState(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_Joint.cpp

@@ -84,6 +84,7 @@ void luaRegister_Joint()
         {"getScaleY", lua_Joint_getScaleY},
         {"getScaleZ", lua_Joint_getScaleZ},
         {"getScene", lua_Joint_getScene},
+        {"getScriptEvent", lua_Joint_getScriptEvent},
         {"getTag", lua_Joint_getTag},
         {"getTerrain", lua_Joint_getTerrain},
         {"getTranslation", lua_Joint_getTranslation},
@@ -410,43 +411,9 @@ int lua_Joint_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                Joint* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Joint_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -3178,6 +3145,54 @@ int lua_Joint_getScene(lua_State* state)
     return 0;
 }
 
+int lua_Joint_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                Joint* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Joint_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joint_getTag(lua_State* state)
 {
     // Get the number of parameters.
@@ -4293,20 +4308,16 @@ int lua_Joint_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 Joint* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -4320,7 +4331,7 @@ int lua_Joint_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_Joint.h

@@ -62,6 +62,7 @@ int lua_Joint_getScaleX(lua_State* state);
 int lua_Joint_getScaleY(lua_State* state);
 int lua_Joint_getScaleZ(lua_State* state);
 int lua_Joint_getScene(lua_State* state);
+int lua_Joint_getScriptEvent(lua_State* state);
 int lua_Joint_getTag(lua_State* state);
 int lua_Joint_getTerrain(lua_State* state);
 int lua_Joint_getTranslation(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_JoystickControl.cpp

@@ -62,6 +62,7 @@ void luaRegister_JoystickControl()
         {"getPadding", lua_JoystickControl_getPadding},
         {"getParent", lua_JoystickControl_getParent},
         {"getRefCount", lua_JoystickControl_getRefCount},
+        {"getScriptEvent", lua_JoystickControl_getScriptEvent},
         {"getSkinColor", lua_JoystickControl_getSkinColor},
         {"getSkinRegion", lua_JoystickControl_getSkinRegion},
         {"getState", lua_JoystickControl_getState},
@@ -311,43 +312,9 @@ int lua_JoystickControl_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                JoystickControl* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_JoystickControl_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -2252,6 +2219,54 @@ int lua_JoystickControl_getRefCount(lua_State* state)
     return 0;
 }
 
+int lua_JoystickControl_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                JoystickControl* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_JoystickControl_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_JoystickControl_getSkinColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -3547,20 +3562,16 @@ int lua_JoystickControl_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 JoystickControl* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3574,7 +3585,7 @@ int lua_JoystickControl_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_JoystickControl.h

@@ -47,6 +47,7 @@ int lua_JoystickControl_getOuterRegionSize(lua_State* state);
 int lua_JoystickControl_getPadding(lua_State* state);
 int lua_JoystickControl_getParent(lua_State* state);
 int lua_JoystickControl_getRefCount(lua_State* state);
+int lua_JoystickControl_getScriptEvent(lua_State* state);
 int lua_JoystickControl_getSkinColor(lua_State* state);
 int lua_JoystickControl_getSkinRegion(lua_State* state);
 int lua_JoystickControl_getState(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_Label.cpp

@@ -59,6 +59,7 @@ void luaRegister_Label()
         {"getPadding", lua_Label_getPadding},
         {"getParent", lua_Label_getParent},
         {"getRefCount", lua_Label_getRefCount},
+        {"getScriptEvent", lua_Label_getScriptEvent},
         {"getSkinColor", lua_Label_getSkinColor},
         {"getSkinRegion", lua_Label_getSkinRegion},
         {"getState", lua_Label_getState},
@@ -305,43 +306,9 @@ int lua_Label_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                Label* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Label_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -2123,6 +2090,54 @@ int lua_Label_getRefCount(lua_State* state)
     return 0;
 }
 
+int lua_Label_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                Label* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Label_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Label_getSkinColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -3374,20 +3389,16 @@ int lua_Label_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 Label* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3401,7 +3412,7 @@ int lua_Label_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_Label.h

@@ -44,6 +44,7 @@ int lua_Label_getOpacity(lua_State* state);
 int lua_Label_getPadding(lua_State* state);
 int lua_Label_getParent(lua_State* state);
 int lua_Label_getRefCount(lua_State* state);
+int lua_Label_getScriptEvent(lua_State* state);
 int lua_Label_getSkinColor(lua_State* state);
 int lua_Label_getSkinRegion(lua_State* state);
 int lua_Label_getState(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_Node.cpp

@@ -82,6 +82,7 @@ void luaRegister_Node()
         {"getScaleY", lua_Node_getScaleY},
         {"getScaleZ", lua_Node_getScaleZ},
         {"getScene", lua_Node_getScene},
+        {"getScriptEvent", lua_Node_getScriptEvent},
         {"getTag", lua_Node_getTag},
         {"getTerrain", lua_Node_getTerrain},
         {"getTranslation", lua_Node_getTranslation},
@@ -409,43 +410,9 @@ int lua_Node_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                Node* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Node_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -3133,6 +3100,54 @@ int lua_Node_getScene(lua_State* state)
     return 0;
 }
 
+int lua_Node_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                Node* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Node_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Node_getTag(lua_State* state)
 {
     // Get the number of parameters.
@@ -4248,20 +4263,16 @@ int lua_Node_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 Node* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -4275,7 +4286,7 @@ int lua_Node_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_Node.h

@@ -61,6 +61,7 @@ int lua_Node_getScaleX(lua_State* state);
 int lua_Node_getScaleY(lua_State* state);
 int lua_Node_getScaleZ(lua_State* state);
 int lua_Node_getScene(lua_State* state);
+int lua_Node_getScriptEvent(lua_State* state);
 int lua_Node_getTag(lua_State* state);
 int lua_Node_getTerrain(lua_State* state);
 int lua_Node_getTranslation(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_PhysicsController.cpp

@@ -31,6 +31,7 @@ void luaRegister_PhysicsController()
         {"createSpringConstraint", lua_PhysicsController_createSpringConstraint},
         {"drawDebug", lua_PhysicsController_drawDebug},
         {"getGravity", lua_PhysicsController_getGravity},
+        {"getScriptEvent", lua_PhysicsController_getScriptEvent},
         {"getTypeName", lua_PhysicsController_getTypeName},
         {"hasScriptListener", lua_PhysicsController_hasScriptListener},
         {"rayTest", lua_PhysicsController_rayTest},
@@ -92,43 +93,9 @@ int lua_PhysicsController_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                PhysicsController* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_PhysicsController_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -1456,6 +1423,54 @@ int lua_PhysicsController_getGravity(lua_State* state)
     return 0;
 }
 
+int lua_PhysicsController_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                PhysicsController* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_PhysicsController_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_PhysicsController_getTypeName(lua_State* state)
 {
     // Get the number of parameters.
@@ -1703,20 +1718,16 @@ int lua_PhysicsController_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 PhysicsController* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -1730,7 +1741,7 @@ int lua_PhysicsController_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_PhysicsController.h

@@ -17,6 +17,7 @@ int lua_PhysicsController_createSocketConstraint(lua_State* state);
 int lua_PhysicsController_createSpringConstraint(lua_State* state);
 int lua_PhysicsController_drawDebug(lua_State* state);
 int lua_PhysicsController_getGravity(lua_State* state);
+int lua_PhysicsController_getScriptEvent(lua_State* state);
 int lua_PhysicsController_getTypeName(lua_State* state);
 int lua_PhysicsController_hasScriptListener(lua_State* state);
 int lua_PhysicsController_rayTest(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_RadioButton.cpp

@@ -63,6 +63,7 @@ void luaRegister_RadioButton()
         {"getPadding", lua_RadioButton_getPadding},
         {"getParent", lua_RadioButton_getParent},
         {"getRefCount", lua_RadioButton_getRefCount},
+        {"getScriptEvent", lua_RadioButton_getScriptEvent},
         {"getSkinColor", lua_RadioButton_getSkinColor},
         {"getSkinRegion", lua_RadioButton_getSkinRegion},
         {"getState", lua_RadioButton_getState},
@@ -312,43 +313,9 @@ int lua_RadioButton_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                RadioButton* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_RadioButton_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -2165,6 +2132,54 @@ int lua_RadioButton_getRefCount(lua_State* state)
     return 0;
 }
 
+int lua_RadioButton_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                RadioButton* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_RadioButton_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_RadioButton_getSkinColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -3451,20 +3466,16 @@ int lua_RadioButton_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 RadioButton* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3478,7 +3489,7 @@ int lua_RadioButton_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_RadioButton.h

@@ -45,6 +45,7 @@ int lua_RadioButton_getOpacity(lua_State* state);
 int lua_RadioButton_getPadding(lua_State* state);
 int lua_RadioButton_getParent(lua_State* state);
 int lua_RadioButton_getRefCount(lua_State* state);
+int lua_RadioButton_getScriptEvent(lua_State* state);
 int lua_RadioButton_getSkinColor(lua_State* state);
 int lua_RadioButton_getSkinRegion(lua_State* state);
 int lua_RadioButton_getState(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_ScriptTarget.cpp

@@ -16,6 +16,7 @@ void luaRegister_ScriptTarget()
         {"addScript", lua_ScriptTarget_addScript},
         {"addScriptCallback", lua_ScriptTarget_addScriptCallback},
         {"clearScripts", lua_ScriptTarget_clearScripts},
+        {"getScriptEvent", lua_ScriptTarget_getScriptEvent},
         {"getTypeName", lua_ScriptTarget_getTypeName},
         {"hasScriptListener", lua_ScriptTarget_hasScriptListener},
         {"removeScript", lua_ScriptTarget_removeScript},
@@ -73,43 +74,9 @@ int lua_ScriptTarget_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                ScriptTarget* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_ScriptTarget_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -195,6 +162,54 @@ int lua_ScriptTarget_clearScripts(lua_State* state)
     return 0;
 }
 
+int lua_ScriptTarget_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                ScriptTarget* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_ScriptTarget_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_ScriptTarget_getTypeName(lua_State* state)
 {
     // Get the number of parameters.
@@ -301,20 +316,16 @@ int lua_ScriptTarget_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 ScriptTarget* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -328,7 +339,7 @@ int lua_ScriptTarget_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_ScriptTarget.h

@@ -9,6 +9,7 @@ namespace gameplay
 int lua_ScriptTarget_addScript(lua_State* state);
 int lua_ScriptTarget_addScriptCallback(lua_State* state);
 int lua_ScriptTarget_clearScripts(lua_State* state);
+int lua_ScriptTarget_getScriptEvent(lua_State* state);
 int lua_ScriptTarget_getTypeName(lua_State* state);
 int lua_ScriptTarget_hasScriptListener(lua_State* state);
 int lua_ScriptTarget_removeScript(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_Slider.cpp

@@ -62,6 +62,7 @@ void luaRegister_Slider()
         {"getPadding", lua_Slider_getPadding},
         {"getParent", lua_Slider_getParent},
         {"getRefCount", lua_Slider_getRefCount},
+        {"getScriptEvent", lua_Slider_getScriptEvent},
         {"getSkinColor", lua_Slider_getSkinColor},
         {"getSkinRegion", lua_Slider_getSkinRegion},
         {"getState", lua_Slider_getState},
@@ -320,43 +321,9 @@ int lua_Slider_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                Slider* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Slider_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -2208,6 +2175,54 @@ int lua_Slider_getRefCount(lua_State* state)
     return 0;
 }
 
+int lua_Slider_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                Slider* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Slider_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Slider_getSkinColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -3634,20 +3649,16 @@ int lua_Slider_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 Slider* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3661,7 +3672,7 @@ int lua_Slider_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_Slider.h

@@ -46,6 +46,7 @@ int lua_Slider_getOpacity(lua_State* state);
 int lua_Slider_getPadding(lua_State* state);
 int lua_Slider_getParent(lua_State* state);
 int lua_Slider_getRefCount(lua_State* state);
+int lua_Slider_getScriptEvent(lua_State* state);
 int lua_Slider_getSkinColor(lua_State* state);
 int lua_Slider_getSkinRegion(lua_State* state);
 int lua_Slider_getState(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_TextBox.cpp

@@ -64,6 +64,7 @@ void luaRegister_TextBox()
         {"getParent", lua_TextBox_getParent},
         {"getPasswordChar", lua_TextBox_getPasswordChar},
         {"getRefCount", lua_TextBox_getRefCount},
+        {"getScriptEvent", lua_TextBox_getScriptEvent},
         {"getSkinColor", lua_TextBox_getSkinColor},
         {"getSkinRegion", lua_TextBox_getSkinRegion},
         {"getState", lua_TextBox_getState},
@@ -313,43 +314,9 @@ int lua_TextBox_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                TextBox* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_TextBox_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -2271,6 +2238,54 @@ int lua_TextBox_getRefCount(lua_State* state)
     return 0;
 }
 
+int lua_TextBox_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                TextBox* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_TextBox_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_TextBox_getSkinColor(lua_State* state)
 {
     // Get the number of parameters.
@@ -3522,20 +3537,16 @@ int lua_TextBox_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 TextBox* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -3549,7 +3560,7 @@ int lua_TextBox_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_TextBox.h

@@ -48,6 +48,7 @@ int lua_TextBox_getPadding(lua_State* state);
 int lua_TextBox_getParent(lua_State* state);
 int lua_TextBox_getPasswordChar(lua_State* state);
 int lua_TextBox_getRefCount(lua_State* state);
+int lua_TextBox_getScriptEvent(lua_State* state);
 int lua_TextBox_getSkinColor(lua_State* state);
 int lua_TextBox_getSkinRegion(lua_State* state);
 int lua_TextBox_getState(lua_State* state);

+ 54 - 43
gameplay/src/lua/lua_Transform.cpp

@@ -40,6 +40,7 @@ void luaRegister_Transform()
         {"getScaleX", lua_Transform_getScaleX},
         {"getScaleY", lua_Transform_getScaleY},
         {"getScaleZ", lua_Transform_getScaleZ},
+        {"getScriptEvent", lua_Transform_getScriptEvent},
         {"getTranslation", lua_Transform_getTranslation},
         {"getTranslationX", lua_Transform_getTranslationX},
         {"getTranslationY", lua_Transform_getTranslationY},
@@ -423,43 +424,9 @@ int lua_Transform_addScript(lua_State* state)
             lua_error(state);
             break;
         }
-        case 3:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = gameplay::ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
-                Transform* instance = getInstance(state);
-                void* returnPtr = ((void*)instance->addScript(param1, param2));
-                if (returnPtr)
-                {
-                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Script");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-
-            lua_pushstring(state, "lua_Transform_addScript - Failed to match the given parameters to a valid function signature.");
-            lua_error(state);
-            break;
-        }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }
@@ -1778,6 +1745,54 @@ int lua_Transform_getScaleZ(lua_State* state)
     return 0;
 }
 
+int lua_Transform_getScriptEvent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = gameplay::ScriptUtil::getString(2, false);
+
+                Transform* instance = getInstance(state);
+                void* returnPtr = ((void*)instance->getScriptEvent(param1));
+                if (returnPtr)
+                {
+                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "ScriptTargetEvent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+
+            lua_pushstring(state, "lua_Transform_getScriptEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Transform_getTranslation(lua_State* state)
 {
     // Get the number of parameters.
@@ -2208,20 +2223,16 @@ int lua_Transform_removeScript(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 2:
         {
             if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
                 const char* param1 = gameplay::ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                Script::Scope param2 = (Script::Scope)luaL_checkint(state, 3);
-
                 Transform* instance = getInstance(state);
-                bool result = instance->removeScript(param1, param2);
+                bool result = instance->removeScript(param1);
 
                 // Push the return value onto the stack.
                 lua_pushboolean(state, result);
@@ -2235,7 +2246,7 @@ int lua_Transform_removeScript(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
             lua_error(state);
             break;
         }

+ 1 - 0
gameplay/src/lua/lua_Transform.h

@@ -30,6 +30,7 @@ int lua_Transform_getScale(lua_State* state);
 int lua_Transform_getScaleX(lua_State* state);
 int lua_Transform_getScaleY(lua_State* state);
 int lua_Transform_getScaleZ(lua_State* state);
+int lua_Transform_getScriptEvent(lua_State* state);
 int lua_Transform_getTranslation(lua_State* state);
 int lua_Transform_getTranslationX(lua_State* state);
 int lua_Transform_getTranslationY(lua_State* state);