Explorar el Código

Fixes and clean up for ScriptTarget.

Chris Culy hace 13 años
padre
commit
44910120f4
Se han modificado 59 ficheros con 1681 adiciones y 16 borrados
  1. 0 1
      gameplay-luagen/README.md
  2. 2 1
      gameplay/android/jni/Android.mk
  3. 2 0
      gameplay/gameplay.vcxproj
  4. 6 0
      gameplay/gameplay.vcxproj.filters
  5. 5 5
      gameplay/src/ScriptTarget.cpp
  6. 8 9
      gameplay/src/ScriptTarget.h
  7. 88 0
      gameplay/src/lua/lua_AIAgent.cpp
  8. 2 0
      gameplay/src/lua/lua_AIAgent.h
  9. 2 0
      gameplay/src/lua/lua_AIAgentListener.cpp
  10. 88 0
      gameplay/src/lua/lua_AIState.cpp
  11. 2 0
      gameplay/src/lua/lua_AIState.h
  12. 2 0
      gameplay/src/lua/lua_AIStateListener.cpp
  13. 2 0
      gameplay/src/lua/lua_AudioListener.cpp
  14. 2 0
      gameplay/src/lua/lua_AudioSource.cpp
  15. 88 0
      gameplay/src/lua/lua_Button.cpp
  16. 2 0
      gameplay/src/lua/lua_Button.h
  17. 2 0
      gameplay/src/lua/lua_Camera.cpp
  18. 88 0
      gameplay/src/lua/lua_CheckBox.cpp
  19. 2 0
      gameplay/src/lua/lua_CheckBox.h
  20. 88 0
      gameplay/src/lua/lua_Container.cpp
  21. 2 0
      gameplay/src/lua/lua_Container.h
  22. 88 0
      gameplay/src/lua/lua_Control.cpp
  23. 2 0
      gameplay/src/lua/lua_Control.h
  24. 2 0
      gameplay/src/lua/lua_ControlListener.cpp
  25. 88 0
      gameplay/src/lua/lua_Form.cpp
  26. 2 0
      gameplay/src/lua/lua_Form.h
  27. 16 0
      gameplay/src/lua/lua_Global.cpp
  28. 88 0
      gameplay/src/lua/lua_Joint.cpp
  29. 2 0
      gameplay/src/lua/lua_Joint.h
  30. 88 0
      gameplay/src/lua/lua_Joystick.cpp
  31. 2 0
      gameplay/src/lua/lua_Joystick.h
  32. 88 0
      gameplay/src/lua/lua_Label.cpp
  33. 2 0
      gameplay/src/lua/lua_Label.h
  34. 2 0
      gameplay/src/lua/lua_MeshSkin.cpp
  35. 88 0
      gameplay/src/lua/lua_Node.cpp
  36. 2 0
      gameplay/src/lua/lua_Node.h
  37. 2 0
      gameplay/src/lua/lua_NodeCloneContext.cpp
  38. 1 0
      gameplay/src/lua/lua_PhysicsCharacter.cpp
  39. 88 0
      gameplay/src/lua/lua_PhysicsController.cpp
  40. 2 0
      gameplay/src/lua/lua_PhysicsController.h
  41. 2 0
      gameplay/src/lua/lua_PhysicsControllerHitFilter.cpp
  42. 2 0
      gameplay/src/lua/lua_PhysicsControllerHitResult.cpp
  43. 2 0
      gameplay/src/lua/lua_PhysicsControllerListener.cpp
  44. 1 0
      gameplay/src/lua/lua_PhysicsGhostObject.cpp
  45. 1 0
      gameplay/src/lua/lua_PhysicsRigidBody.cpp
  46. 1 0
      gameplay/src/lua/lua_PhysicsRigidBodyParameters.cpp
  47. 88 0
      gameplay/src/lua/lua_RadioButton.cpp
  48. 2 0
      gameplay/src/lua/lua_RadioButton.h
  49. 156 0
      gameplay/src/lua/lua_ScriptTarget.cpp
  50. 16 0
      gameplay/src/lua/lua_ScriptTarget.h
  51. 88 0
      gameplay/src/lua/lua_Slider.cpp
  52. 2 0
      gameplay/src/lua/lua_Slider.h
  53. 88 0
      gameplay/src/lua/lua_TextBox.cpp
  54. 2 0
      gameplay/src/lua/lua_TextBox.h
  55. 88 0
      gameplay/src/lua/lua_Transform.cpp
  56. 2 0
      gameplay/src/lua/lua_Transform.h
  57. 2 0
      gameplay/src/lua/lua_TransformListener.cpp
  58. 1 0
      gameplay/src/lua/lua_all_bindings.cpp
  59. 1 0
      gameplay/src/lua/lua_all_bindings.h

+ 0 - 1
gameplay-luagen/README.md

@@ -40,7 +40,6 @@ There are also prebuilt binaries in the gameplay/bin folder.
 
 
 ### To Do List
-- ScriptTarget class (remove ScriptListener class).
 - Add support for users to generate bindings for their own classes.
 - Look into updating bindValue() to support binding to any Lua script function.
 - Add a global function that implements casting for use from Lua scripts (i.e. to downcast from a Control to a Button).

+ 2 - 1
gameplay/android/jni/Android.mk

@@ -91,7 +91,7 @@ LOCAL_SRC_FILES := \
     SceneLoader.cpp \
     ScreenDisplayer.cpp \
     ScriptController.cpp \
-    ScriptListener.cpp \
+    ScriptTarget.cpp \
     Slider.cpp \
     SpriteBatch.cpp \
     Technique.cpp \
@@ -227,6 +227,7 @@ LOCAL_SRC_FILES := \
     lua/lua_SceneDebugFlags.cpp \
     lua/lua_ScreenDisplayer.cpp \
     lua/lua_ScriptController.cpp \
+    lua/lua_ScriptTarget.cpp \
     lua/lua_Slider.cpp \
     lua/lua_SpriteBatch.cpp \
     lua/lua_Technique.cpp \

+ 2 - 0
gameplay/gameplay.vcxproj

@@ -187,6 +187,7 @@
     <ClCompile Include="src\lua\lua_SceneDebugFlags.cpp" />
     <ClCompile Include="src\lua\lua_ScreenDisplayer.cpp" />
     <ClCompile Include="src\lua\lua_ScriptController.cpp" />
+    <ClCompile Include="src\lua\lua_ScriptTarget.cpp" />
     <ClCompile Include="src\lua\lua_Slider.cpp" />
     <ClCompile Include="src\lua\lua_SpriteBatch.cpp" />
     <ClCompile Include="src\lua\lua_Technique.cpp" />
@@ -443,6 +444,7 @@
     <ClInclude Include="src\lua\lua_SceneDebugFlags.h" />
     <ClInclude Include="src\lua\lua_ScreenDisplayer.h" />
     <ClInclude Include="src\lua\lua_ScriptController.h" />
+    <ClInclude Include="src\lua\lua_ScriptTarget.h" />
     <ClInclude Include="src\lua\lua_Slider.h" />
     <ClInclude Include="src\lua\lua_SpriteBatch.h" />
     <ClInclude Include="src\lua\lua_Technique.h" />

+ 6 - 0
gameplay/gameplay.vcxproj.filters

@@ -777,6 +777,9 @@
     <ClCompile Include="src\ScriptTarget.cpp">
       <Filter>src</Filter>
     </ClCompile>
+    <ClCompile Include="src\lua\lua_ScriptTarget.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\Animation.h">
@@ -1547,6 +1550,9 @@
     <ClInclude Include="src\ScriptTarget.h">
       <Filter>src</Filter>
     </ClInclude>
+    <ClInclude Include="src\lua\lua_ScriptTarget.h">
+      <Filter>lua</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <None Include="src\gameplay-main-macosx.mm">

+ 5 - 5
gameplay/src/ScriptTarget.cpp

@@ -83,7 +83,7 @@ template<> bool ScriptTarget::fireEvent<bool>(const char* eventName, ...)
     return false;
 }
 
-void ScriptTarget::addCallback(const std::string& eventName, const std::string& function, void* data)
+void ScriptTarget::addCallback(const std::string& eventName, const std::string& function)
 {
     std::map<std::string, std::vector<Callback>* >::iterator iter = _callbacks.find(eventName);
     if (iter != _callbacks.end())
@@ -93,7 +93,7 @@ void ScriptTarget::addCallback(const std::string& eventName, const std::string&
 
         // Add the function to the list of callbacks.
         std::string functionName = Game::getInstance()->getScriptController()->loadUrl(function.c_str());
-        iter->second->push_back(Callback(functionName, data));
+        iter->second->push_back(Callback(functionName));
     }
     else
     {
@@ -101,7 +101,7 @@ void ScriptTarget::addCallback(const std::string& eventName, const std::string&
     }
 }
 
-void ScriptTarget::removeCallback(const std::string& eventName, const std::string& function, void* data)
+void ScriptTarget::removeCallback(const std::string& eventName, const std::string& function)
 {
     std::map<std::string, std::vector<Callback>* >::iterator iter = _callbacks.find(eventName);
     if (iter != _callbacks.end())
@@ -120,7 +120,7 @@ void ScriptTarget::removeCallback(const std::string& eventName, const std::strin
         // Remove the function from the list of callbacks.
         for (unsigned int i = 0; i < iter->second->size(); i++)
         {
-            if ((*iter->second)[i].data == data && (*iter->second)[i].function == id)
+            if ((*iter->second)[i].function == id)
             {
                 iter->second->erase(iter->second->begin() + i);
                 return;
@@ -139,7 +139,7 @@ void ScriptTarget::addEvent(const std::string& eventName, const char* argsString
     _callbacks[eventName] = NULL;
 }
 
-ScriptTarget::Callback::Callback(const std::string& function, void* data) : function(function), data(data)
+ScriptTarget::Callback::Callback(const std::string& function) : function(function)
 {
 }
 

+ 8 - 9
gameplay/src/ScriptTarget.h

@@ -8,8 +8,6 @@ namespace gameplay
 
 /**
  * Generic base class for supporting script callbacks.
- * 
- * @script{ignore}
  */
 class ScriptTarget
 {
@@ -33,20 +31,23 @@ public:
      * @param function The name of the Lua script function to call when the event is fired; can either be
      *      just the name of a function (if the function's script file has already been loaded), or can be
      *      a URL of the form scriptFile.lua#functionName.
-     * @param data Optional data for the callback.
      */
-    virtual void addCallback(const std::string& eventName, const std::string& function, void* data = NULL);
+    virtual void addCallback(const std::string& eventName, const std::string& function);
 
     /**
      * Removes the given Lua script function as a callback for the given event.
      * 
      * @param eventName The name of the event.
      * @param function The name of the Lua script function.
-     * @param data Optional data for the callback.
      */
-    virtual void removeCallback(const std::string& eventName, const std::string& function, void* data = NULL);
+    virtual void removeCallback(const std::string& eventName, const std::string& function);
 
 protected:
+    /**
+     * Hidden constructor.
+     */
+    ScriptTarget() {}
+
     /**
      * Adds the given event with the given Lua script parameter string ({@link ScriptController::executeFunction})
      * as a supported event for this script target.
@@ -60,12 +61,10 @@ protected:
     struct Callback
     {
         /** Constructor. */
-        Callback(const std::string& string, void* data);
+        Callback(const std::string& string);
 
         /** Holds the Lua script callback function. */
         std::string function;
-        /** Generic data storage. */
-        void* data;
     };
 
     /** Holds the supported events for this script target. */

+ 88 - 0
gameplay/src/lua/lua_AIAgent.cpp

@@ -6,6 +6,8 @@
 #include "Game.h"
 #include "Node.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 
 namespace gameplay
 {
@@ -14,6 +16,7 @@ void luaRegister_AIAgent()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_AIAgent_addCallback},
         {"addRef", lua_AIAgent_addRef},
         {"getId", lua_AIAgent_getId},
         {"getNode", lua_AIAgent_getNode},
@@ -21,6 +24,7 @@ void luaRegister_AIAgent()
         {"getStateMachine", lua_AIAgent_getStateMachine},
         {"isEnabled", lua_AIAgent_isEnabled},
         {"release", lua_AIAgent_release},
+        {"removeCallback", lua_AIAgent_removeCallback},
         {"setEnabled", lua_AIAgent_setEnabled},
         {"setListener", lua_AIAgent_setListener},
         {NULL, NULL}
@@ -82,6 +86,48 @@ int lua_AIAgent__gc(lua_State* state)
     return 0;
 }
 
+int lua_AIAgent_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                AIAgent* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgent_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_AIAgent_addRef(lua_State* state)
 {
     // Get the number of parameters.
@@ -353,6 +399,48 @@ int lua_AIAgent_release(lua_State* state)
     return 0;
 }
 
+int lua_AIAgent_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                AIAgent* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgent_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_AIAgent_setEnabled(lua_State* state)
 {
     // Get the number of parameters.

+ 2 - 0
gameplay/src/lua/lua_AIAgent.h

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for AIAgent.
 int lua_AIAgent__gc(lua_State* state);
+int lua_AIAgent_addCallback(lua_State* state);
 int lua_AIAgent_addRef(lua_State* state);
 int lua_AIAgent_getId(lua_State* state);
 int lua_AIAgent_getNode(lua_State* state);
@@ -13,6 +14,7 @@ int lua_AIAgent_getRefCount(lua_State* state);
 int lua_AIAgent_getStateMachine(lua_State* state);
 int lua_AIAgent_isEnabled(lua_State* state);
 int lua_AIAgent_release(lua_State* state);
+int lua_AIAgent_removeCallback(lua_State* state);
 int lua_AIAgent_setEnabled(lua_State* state);
 int lua_AIAgent_setListener(lua_State* state);
 int lua_AIAgent_static_create(lua_State* state);

+ 2 - 0
gameplay/src/lua/lua_AIAgentListener.cpp

@@ -6,6 +6,8 @@
 #include "Game.h"
 #include "Node.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 
 namespace gameplay
 {

+ 88 - 0
gameplay/src/lua/lua_AIState.cpp

@@ -6,6 +6,8 @@
 #include "Base.h"
 #include "Game.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 
 namespace gameplay
 {
@@ -14,10 +16,12 @@ void luaRegister_AIState()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_AIState_addCallback},
         {"addRef", lua_AIState_addRef},
         {"getId", lua_AIState_getId},
         {"getRefCount", lua_AIState_getRefCount},
         {"release", lua_AIState_release},
+        {"removeCallback", lua_AIState_removeCallback},
         {"setListener", lua_AIState_setListener},
         {NULL, NULL}
     };
@@ -78,6 +82,48 @@ int lua_AIState__gc(lua_State* state)
     return 0;
 }
 
+int lua_AIState_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                AIState* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIState_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_AIState_addRef(lua_State* state)
 {
     // Get the number of parameters.
@@ -220,6 +266,48 @@ int lua_AIState_release(lua_State* state)
     return 0;
 }
 
+int lua_AIState_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                AIState* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIState_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_AIState_setListener(lua_State* state)
 {
     // Get the number of parameters.

+ 2 - 0
gameplay/src/lua/lua_AIState.h

@@ -6,10 +6,12 @@ namespace gameplay
 
 // Lua bindings for AIState.
 int lua_AIState__gc(lua_State* state);
+int lua_AIState_addCallback(lua_State* state);
 int lua_AIState_addRef(lua_State* state);
 int lua_AIState_getId(lua_State* state);
 int lua_AIState_getRefCount(lua_State* state);
 int lua_AIState_release(lua_State* state);
+int lua_AIState_removeCallback(lua_State* state);
 int lua_AIState_setListener(lua_State* state);
 int lua_AIState_static_create(lua_State* state);
 

+ 2 - 0
gameplay/src/lua/lua_AIStateListener.cpp

@@ -6,6 +6,8 @@
 #include "Base.h"
 #include "Game.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 
 namespace gameplay
 {

+ 2 - 0
gameplay/src/lua/lua_AudioListener.cpp

@@ -7,6 +7,8 @@
 #include "Base.h"
 #include "Game.h"
 #include "Node.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CurveInterpolationType.h"
 

+ 2 - 0
gameplay/src/lua/lua_AudioSource.cpp

@@ -10,6 +10,8 @@
 #include "Game.h"
 #include "Node.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_AudioSourceState.h"
 #include "lua_CurveInterpolationType.h"

+ 88 - 0
gameplay/src/lua/lua_Button.cpp

@@ -10,6 +10,8 @@
 #include "Label.h"
 #include "Node.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "lua_ControlAlignment.h"
 #include "lua_ControlListenerEventType.h"
 #include "lua_ControlState.h"
@@ -23,6 +25,7 @@ void luaRegister_Button()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_Button_addCallback},
         {"addListener", lua_Button_addListener},
         {"addRef", lua_Button_addRef},
         {"createAnimation", lua_Button_createAnimation},
@@ -72,6 +75,7 @@ void luaRegister_Button()
         {"isContainer", lua_Button_isContainer},
         {"isEnabled", lua_Button_isEnabled},
         {"release", lua_Button_release},
+        {"removeCallback", lua_Button_removeCallback},
         {"setAlignment", lua_Button_setAlignment},
         {"setAnimationPropertyValue", lua_Button_setAnimationPropertyValue},
         {"setAutoHeight", lua_Button_setAutoHeight},
@@ -166,6 +170,48 @@ int lua_Button__gc(lua_State* state)
     return 0;
 }
 
+int lua_Button_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Button* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Button_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Button_addListener(lua_State* state)
 {
     // Get the number of parameters.
@@ -2702,6 +2748,48 @@ int lua_Button_release(lua_State* state)
     return 0;
 }
 
+int lua_Button_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Button* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Button_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Button_setAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for Button.
 int lua_Button__gc(lua_State* state);
+int lua_Button_addCallback(lua_State* state);
 int lua_Button_addListener(lua_State* state);
 int lua_Button_addRef(lua_State* state);
 int lua_Button_createAnimation(lua_State* state);
@@ -55,6 +56,7 @@ int lua_Button_getZIndex(lua_State* state);
 int lua_Button_isContainer(lua_State* state);
 int lua_Button_isEnabled(lua_State* state);
 int lua_Button_release(lua_State* state);
+int lua_Button_removeCallback(lua_State* state);
 int lua_Button_setAlignment(lua_State* state);
 int lua_Button_setAnimationPropertyValue(lua_State* state);
 int lua_Button_setAutoHeight(lua_State* state);

+ 2 - 0
gameplay/src/lua/lua_Camera.cpp

@@ -9,6 +9,8 @@
 #include "Node.h"
 #include "PhysicsController.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CameraType.h"
 #include "lua_CurveInterpolationType.h"

+ 88 - 0
gameplay/src/lua/lua_CheckBox.cpp

@@ -11,6 +11,8 @@
 #include "Label.h"
 #include "Node.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "lua_ControlAlignment.h"
 #include "lua_ControlListenerEventType.h"
 #include "lua_ControlState.h"
@@ -24,6 +26,7 @@ void luaRegister_CheckBox()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_CheckBox_addCallback},
         {"addListener", lua_CheckBox_addListener},
         {"addRef", lua_CheckBox_addRef},
         {"createAnimation", lua_CheckBox_createAnimation},
@@ -76,6 +79,7 @@ void luaRegister_CheckBox()
         {"isContainer", lua_CheckBox_isContainer},
         {"isEnabled", lua_CheckBox_isEnabled},
         {"release", lua_CheckBox_release},
+        {"removeCallback", lua_CheckBox_removeCallback},
         {"setAlignment", lua_CheckBox_setAlignment},
         {"setAnimationPropertyValue", lua_CheckBox_setAnimationPropertyValue},
         {"setAutoHeight", lua_CheckBox_setAutoHeight},
@@ -172,6 +176,48 @@ int lua_CheckBox__gc(lua_State* state)
     return 0;
 }
 
+int lua_CheckBox_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                CheckBox* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_CheckBox_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_CheckBox_addListener(lua_State* state)
 {
     // Get the number of parameters.
@@ -2828,6 +2874,48 @@ int lua_CheckBox_release(lua_State* state)
     return 0;
 }
 
+int lua_CheckBox_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                CheckBox* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_CheckBox_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_CheckBox_setAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for CheckBox.
 int lua_CheckBox__gc(lua_State* state);
+int lua_CheckBox_addCallback(lua_State* state);
 int lua_CheckBox_addListener(lua_State* state);
 int lua_CheckBox_addRef(lua_State* state);
 int lua_CheckBox_createAnimation(lua_State* state);
@@ -58,6 +59,7 @@ int lua_CheckBox_isChecked(lua_State* state);
 int lua_CheckBox_isContainer(lua_State* state);
 int lua_CheckBox_isEnabled(lua_State* state);
 int lua_CheckBox_release(lua_State* state);
+int lua_CheckBox_removeCallback(lua_State* state);
 int lua_CheckBox_setAlignment(lua_State* state);
 int lua_CheckBox_setAnimationPropertyValue(lua_State* state);
 int lua_CheckBox_setAutoHeight(lua_State* state);

+ 88 - 0
gameplay/src/lua/lua_Container.cpp

@@ -17,6 +17,8 @@
 #include "Node.h"
 #include "RadioButton.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Slider.h"
 #include "TextBox.h"
 #include "VerticalLayout.h"
@@ -35,6 +37,7 @@ void luaRegister_Container()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_Container_addCallback},
         {"addControl", lua_Container_addControl},
         {"addListener", lua_Container_addListener},
         {"addRef", lua_Container_addRef},
@@ -90,6 +93,7 @@ void luaRegister_Container()
         {"isEnabled", lua_Container_isEnabled},
         {"isScrollBarsAutoHide", lua_Container_isScrollBarsAutoHide},
         {"release", lua_Container_release},
+        {"removeCallback", lua_Container_removeCallback},
         {"removeControl", lua_Container_removeControl},
         {"setAlignment", lua_Container_setAlignment},
         {"setAnimationPropertyValue", lua_Container_setAnimationPropertyValue},
@@ -187,6 +191,48 @@ int lua_Container__gc(lua_State* state)
     return 0;
 }
 
+int lua_Container_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Container* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Container_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Container_addControl(lua_State* state)
 {
     // Get the number of parameters.
@@ -2999,6 +3045,48 @@ int lua_Container_release(lua_State* state)
     return 0;
 }
 
+int lua_Container_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Container* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Container_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Container_removeControl(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for Container.
 int lua_Container__gc(lua_State* state);
+int lua_Container_addCallback(lua_State* state);
 int lua_Container_addControl(lua_State* state);
 int lua_Container_addListener(lua_State* state);
 int lua_Container_addRef(lua_State* state);
@@ -61,6 +62,7 @@ int lua_Container_isContainer(lua_State* state);
 int lua_Container_isEnabled(lua_State* state);
 int lua_Container_isScrollBarsAutoHide(lua_State* state);
 int lua_Container_release(lua_State* state);
+int lua_Container_removeCallback(lua_State* state);
 int lua_Container_removeControl(lua_State* state);
 int lua_Container_setAlignment(lua_State* state);
 int lua_Container_setAnimationPropertyValue(lua_State* state);

+ 88 - 0
gameplay/src/lua/lua_Control.cpp

@@ -8,6 +8,8 @@
 #include "Game.h"
 #include "Node.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "lua_ControlAlignment.h"
 #include "lua_ControlListenerEventType.h"
 #include "lua_ControlState.h"
@@ -21,6 +23,7 @@ void luaRegister_Control()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_Control_addCallback},
         {"addListener", lua_Control_addListener},
         {"addRef", lua_Control_addRef},
         {"createAnimation", lua_Control_createAnimation},
@@ -70,6 +73,7 @@ void luaRegister_Control()
         {"isContainer", lua_Control_isContainer},
         {"isEnabled", lua_Control_isEnabled},
         {"release", lua_Control_release},
+        {"removeCallback", lua_Control_removeCallback},
         {"setAlignment", lua_Control_setAlignment},
         {"setAnimationPropertyValue", lua_Control_setAnimationPropertyValue},
         {"setAutoHeight", lua_Control_setAutoHeight},
@@ -162,6 +166,48 @@ int lua_Control__gc(lua_State* state)
     return 0;
 }
 
+int lua_Control_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Control* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Control_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Control_addListener(lua_State* state)
 {
     // Get the number of parameters.
@@ -2698,6 +2744,48 @@ int lua_Control_release(lua_State* state)
     return 0;
 }
 
+int lua_Control_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Control* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Control_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Control_setAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for Control.
 int lua_Control__gc(lua_State* state);
+int lua_Control_addCallback(lua_State* state);
 int lua_Control_addListener(lua_State* state);
 int lua_Control_addRef(lua_State* state);
 int lua_Control_createAnimation(lua_State* state);
@@ -55,6 +56,7 @@ int lua_Control_getZIndex(lua_State* state);
 int lua_Control_isContainer(lua_State* state);
 int lua_Control_isEnabled(lua_State* state);
 int lua_Control_release(lua_State* state);
+int lua_Control_removeCallback(lua_State* state);
 int lua_Control_setAlignment(lua_State* state);
 int lua_Control_setAnimationPropertyValue(lua_State* state);
 int lua_Control_setAutoHeight(lua_State* state);

+ 2 - 0
gameplay/src/lua/lua_ControlListener.cpp

@@ -8,6 +8,8 @@
 #include "Game.h"
 #include "Node.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "lua_ControlAlignment.h"
 #include "lua_ControlListenerEventType.h"
 #include "lua_ControlState.h"

+ 88 - 0
gameplay/src/lua/lua_Form.cpp

@@ -19,6 +19,8 @@
 #include "RadioButton.h"
 #include "Ref.h"
 #include "Scene.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Slider.h"
 #include "TextBox.h"
 #include "Theme.h"
@@ -38,6 +40,7 @@ void luaRegister_Form()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_Form_addCallback},
         {"addControl", lua_Form_addControl},
         {"addListener", lua_Form_addListener},
         {"addRef", lua_Form_addRef},
@@ -95,6 +98,7 @@ void luaRegister_Form()
         {"isEnabled", lua_Form_isEnabled},
         {"isScrollBarsAutoHide", lua_Form_isScrollBarsAutoHide},
         {"release", lua_Form_release},
+        {"removeCallback", lua_Form_removeCallback},
         {"removeControl", lua_Form_removeControl},
         {"setAlignment", lua_Form_setAlignment},
         {"setAnimationPropertyValue", lua_Form_setAnimationPropertyValue},
@@ -195,6 +199,48 @@ int lua_Form__gc(lua_State* state)
     return 0;
 }
 
+int lua_Form_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Form* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Form_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Form_addControl(lua_State* state)
 {
     // Get the number of parameters.
@@ -3087,6 +3133,48 @@ int lua_Form_release(lua_State* state)
     return 0;
 }
 
+int lua_Form_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Form* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Form_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Form_removeControl(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for Form.
 int lua_Form__gc(lua_State* state);
+int lua_Form_addCallback(lua_State* state);
 int lua_Form_addControl(lua_State* state);
 int lua_Form_addListener(lua_State* state);
 int lua_Form_addRef(lua_State* state);
@@ -63,6 +64,7 @@ int lua_Form_isContainer(lua_State* state);
 int lua_Form_isEnabled(lua_State* state);
 int lua_Form_isScrollBarsAutoHide(lua_State* state);
 int lua_Form_release(lua_State* state);
+int lua_Form_removeCallback(lua_State* state);
 int lua_Form_removeControl(lua_State* state);
 int lua_Form_setAlignment(lua_State* state);
 int lua_Form_setAnimationPropertyValue(lua_State* state);

+ 16 - 0
gameplay/src/lua/lua_Global.cpp

@@ -109,6 +109,22 @@ void luaRegister_lua_Global()
     hierarchy["RenderState"].push_back("Material");
     hierarchy["RenderState"].push_back("Pass");
     hierarchy["RenderState"].push_back("Technique");
+    hierarchy["ScriptTarget"].push_back("AIAgent");
+    hierarchy["ScriptTarget"].push_back("AIState");
+    hierarchy["ScriptTarget"].push_back("Button");
+    hierarchy["ScriptTarget"].push_back("CheckBox");
+    hierarchy["ScriptTarget"].push_back("Container");
+    hierarchy["ScriptTarget"].push_back("Control");
+    hierarchy["ScriptTarget"].push_back("Form");
+    hierarchy["ScriptTarget"].push_back("Joint");
+    hierarchy["ScriptTarget"].push_back("Joystick");
+    hierarchy["ScriptTarget"].push_back("Label");
+    hierarchy["ScriptTarget"].push_back("Node");
+    hierarchy["ScriptTarget"].push_back("PhysicsController");
+    hierarchy["ScriptTarget"].push_back("RadioButton");
+    hierarchy["ScriptTarget"].push_back("Slider");
+    hierarchy["ScriptTarget"].push_back("TextBox");
+    hierarchy["ScriptTarget"].push_back("Transform");
     hierarchy["Transform"].push_back("Joint");
     hierarchy["Transform"].push_back("Node");
     hierarchy["Transform::Listener"].push_back("AudioListener");

+ 88 - 0
gameplay/src/lua/lua_Joint.cpp

@@ -14,6 +14,8 @@
 #include "PhysicsRigidBody.h"
 #include "Ref.h"
 #include "Scene.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CurveInterpolationType.h"
 #include "lua_NodeType.h"
@@ -26,6 +28,7 @@ void luaRegister_Joint()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_Joint_addCallback},
         {"addChild", lua_Joint_addChild},
         {"addListener", lua_Joint_addListener},
         {"addRef", lua_Joint_addRef},
@@ -97,6 +100,7 @@ void luaRegister_Joint()
         {"isVisible", lua_Joint_isVisible},
         {"release", lua_Joint_release},
         {"removeAllChildren", lua_Joint_removeAllChildren},
+        {"removeCallback", lua_Joint_removeCallback},
         {"removeChild", lua_Joint_removeChild},
         {"removeListener", lua_Joint_removeListener},
         {"rotate", lua_Joint_rotate},
@@ -213,6 +217,48 @@ int lua_Joint__gc(lua_State* state)
     return 0;
 }
 
+int lua_Joint_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Joint* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Joint_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joint_addChild(lua_State* state)
 {
     // Get the number of parameters.
@@ -3845,6 +3891,48 @@ int lua_Joint_removeAllChildren(lua_State* state)
     return 0;
 }
 
+int lua_Joint_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Joint* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Joint_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joint_removeChild(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for Joint.
 int lua_Joint__gc(lua_State* state);
+int lua_Joint_addCallback(lua_State* state);
 int lua_Joint_addChild(lua_State* state);
 int lua_Joint_addListener(lua_State* state);
 int lua_Joint_addRef(lua_State* state);
@@ -77,6 +78,7 @@ int lua_Joint_isTransparent(lua_State* state);
 int lua_Joint_isVisible(lua_State* state);
 int lua_Joint_release(lua_State* state);
 int lua_Joint_removeAllChildren(lua_State* state);
+int lua_Joint_removeCallback(lua_State* state);
 int lua_Joint_removeChild(lua_State* state);
 int lua_Joint_removeListener(lua_State* state);
 int lua_Joint_rotate(lua_State* state);

+ 88 - 0
gameplay/src/lua/lua_Joystick.cpp

@@ -9,6 +9,8 @@
 #include "Joystick.h"
 #include "Node.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "lua_ControlAlignment.h"
 #include "lua_ControlListenerEventType.h"
 #include "lua_ControlState.h"
@@ -22,6 +24,7 @@ void luaRegister_Joystick()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_Joystick_addCallback},
         {"addListener", lua_Joystick_addListener},
         {"addRef", lua_Joystick_addRef},
         {"createAnimation", lua_Joystick_createAnimation},
@@ -74,6 +77,7 @@ void luaRegister_Joystick()
         {"isContainer", lua_Joystick_isContainer},
         {"isEnabled", lua_Joystick_isEnabled},
         {"release", lua_Joystick_release},
+        {"removeCallback", lua_Joystick_removeCallback},
         {"setAbsolute", lua_Joystick_setAbsolute},
         {"setAlignment", lua_Joystick_setAlignment},
         {"setAnimationPropertyValue", lua_Joystick_setAnimationPropertyValue},
@@ -169,6 +173,48 @@ int lua_Joystick__gc(lua_State* state)
     return 0;
 }
 
+int lua_Joystick_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Joystick* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Joystick_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joystick_addListener(lua_State* state)
 {
     // Get the number of parameters.
@@ -2834,6 +2880,48 @@ int lua_Joystick_release(lua_State* state)
     return 0;
 }
 
+int lua_Joystick_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Joystick* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Joystick_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Joystick_setAbsolute(lua_State* state)
 {
     // Get the number of parameters.

+ 2 - 0
gameplay/src/lua/lua_Joystick.h

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for Joystick.
 int lua_Joystick__gc(lua_State* state);
+int lua_Joystick_addCallback(lua_State* state);
 int lua_Joystick_addListener(lua_State* state);
 int lua_Joystick_addRef(lua_State* state);
 int lua_Joystick_createAnimation(lua_State* state);
@@ -58,6 +59,7 @@ int lua_Joystick_isAbsolute(lua_State* state);
 int lua_Joystick_isContainer(lua_State* state);
 int lua_Joystick_isEnabled(lua_State* state);
 int lua_Joystick_release(lua_State* state);
+int lua_Joystick_removeCallback(lua_State* state);
 int lua_Joystick_setAbsolute(lua_State* state);
 int lua_Joystick_setAlignment(lua_State* state);
 int lua_Joystick_setAnimationPropertyValue(lua_State* state);

+ 88 - 0
gameplay/src/lua/lua_Label.cpp

@@ -9,6 +9,8 @@
 #include "Label.h"
 #include "Node.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "lua_ControlAlignment.h"
 #include "lua_ControlListenerEventType.h"
 #include "lua_ControlState.h"
@@ -22,6 +24,7 @@ void luaRegister_Label()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_Label_addCallback},
         {"addListener", lua_Label_addListener},
         {"addRef", lua_Label_addRef},
         {"createAnimation", lua_Label_createAnimation},
@@ -72,6 +75,7 @@ void luaRegister_Label()
         {"isContainer", lua_Label_isContainer},
         {"isEnabled", lua_Label_isEnabled},
         {"release", lua_Label_release},
+        {"removeCallback", lua_Label_removeCallback},
         {"setAlignment", lua_Label_setAlignment},
         {"setAnimationPropertyValue", lua_Label_setAnimationPropertyValue},
         {"setAutoHeight", lua_Label_setAutoHeight},
@@ -166,6 +170,48 @@ int lua_Label__gc(lua_State* state)
     return 0;
 }
 
+int lua_Label_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Label* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Label_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Label_addListener(lua_State* state)
 {
     // Get the number of parameters.
@@ -2739,6 +2785,48 @@ int lua_Label_release(lua_State* state)
     return 0;
 }
 
+int lua_Label_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Label* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Label_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Label_setAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for Label.
 int lua_Label__gc(lua_State* state);
+int lua_Label_addCallback(lua_State* state);
 int lua_Label_addListener(lua_State* state);
 int lua_Label_addRef(lua_State* state);
 int lua_Label_createAnimation(lua_State* state);
@@ -56,6 +57,7 @@ int lua_Label_getZIndex(lua_State* state);
 int lua_Label_isContainer(lua_State* state);
 int lua_Label_isEnabled(lua_State* state);
 int lua_Label_release(lua_State* state);
+int lua_Label_removeCallback(lua_State* state);
 int lua_Label_setAlignment(lua_State* state);
 int lua_Label_setAnimationPropertyValue(lua_State* state);
 int lua_Label_setAutoHeight(lua_State* state);

+ 2 - 0
gameplay/src/lua/lua_MeshSkin.cpp

@@ -8,6 +8,8 @@
 #include "Joint.h"
 #include "MeshSkin.h"
 #include "Node.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CurveInterpolationType.h"
 

+ 88 - 0
gameplay/src/lua/lua_Node.cpp

@@ -13,6 +13,8 @@
 #include "PhysicsRigidBody.h"
 #include "Ref.h"
 #include "Scene.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CurveInterpolationType.h"
 #include "lua_NodeType.h"
@@ -25,6 +27,7 @@ void luaRegister_Node()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_Node_addCallback},
         {"addChild", lua_Node_addChild},
         {"addListener", lua_Node_addListener},
         {"addRef", lua_Node_addRef},
@@ -95,6 +98,7 @@ void luaRegister_Node()
         {"isVisible", lua_Node_isVisible},
         {"release", lua_Node_release},
         {"removeAllChildren", lua_Node_removeAllChildren},
+        {"removeCallback", lua_Node_removeCallback},
         {"removeChild", lua_Node_removeChild},
         {"removeListener", lua_Node_removeListener},
         {"rotate", lua_Node_rotate},
@@ -212,6 +216,48 @@ int lua_Node__gc(lua_State* state)
     return 0;
 }
 
+int lua_Node_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Node* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Node_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Node_addChild(lua_State* state)
 {
     // Get the number of parameters.
@@ -3798,6 +3844,48 @@ int lua_Node_removeAllChildren(lua_State* state)
     return 0;
 }
 
+int lua_Node_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Node* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Node_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Node_removeChild(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for Node.
 int lua_Node__gc(lua_State* state);
+int lua_Node_addCallback(lua_State* state);
 int lua_Node_addChild(lua_State* state);
 int lua_Node_addListener(lua_State* state);
 int lua_Node_addRef(lua_State* state);
@@ -76,6 +77,7 @@ int lua_Node_isTransparent(lua_State* state);
 int lua_Node_isVisible(lua_State* state);
 int lua_Node_release(lua_State* state);
 int lua_Node_removeAllChildren(lua_State* state);
+int lua_Node_removeCallback(lua_State* state);
 int lua_Node_removeChild(lua_State* state);
 int lua_Node_removeListener(lua_State* state);
 int lua_Node_rotate(lua_State* state);

+ 2 - 0
gameplay/src/lua/lua_NodeCloneContext.cpp

@@ -13,6 +13,8 @@
 #include "PhysicsRigidBody.h"
 #include "Ref.h"
 #include "Scene.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CurveInterpolationType.h"
 #include "lua_NodeType.h"

+ 1 - 0
gameplay/src/lua/lua_PhysicsCharacter.cpp

@@ -12,6 +12,7 @@
 #include "PhysicsGhostObject.h"
 #include "Scene.h"
 #include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CurveInterpolationType.h"
 #include "lua_PhysicsCollisionObjectCollisionListenerEventType.h"

+ 88 - 0
gameplay/src/lua/lua_PhysicsController.cpp

@@ -8,6 +8,8 @@
 #include "PhysicsCharacter.h"
 #include "PhysicsController.h"
 #include "PhysicsRigidBody.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "lua_PhysicsControllerListenerEventType.h"
 
 namespace gameplay
@@ -17,6 +19,7 @@ void luaRegister_PhysicsController()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_PhysicsController_addCallback},
         {"addStatusListener", lua_PhysicsController_addStatusListener},
         {"createFixedConstraint", lua_PhysicsController_createFixedConstraint},
         {"createGenericConstraint", lua_PhysicsController_createGenericConstraint},
@@ -26,6 +29,7 @@ void luaRegister_PhysicsController()
         {"drawDebug", lua_PhysicsController_drawDebug},
         {"getGravity", lua_PhysicsController_getGravity},
         {"rayTest", lua_PhysicsController_rayTest},
+        {"removeCallback", lua_PhysicsController_removeCallback},
         {"removeStatusListener", lua_PhysicsController_removeStatusListener},
         {"setGravity", lua_PhysicsController_setGravity},
         {"sweepTest", lua_PhysicsController_sweepTest},
@@ -44,6 +48,48 @@ static PhysicsController* getInstance(lua_State* state)
     return (PhysicsController*)((ScriptUtil::LuaObject*)userdata)->instance;
 }
 
+int lua_PhysicsController_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                PhysicsController* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsController_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_PhysicsController_addStatusListener(lua_State* state)
 {
     // Get the number of parameters.
@@ -1138,6 +1184,48 @@ int lua_PhysicsController_rayTest(lua_State* state)
     return 0;
 }
 
+int lua_PhysicsController_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                PhysicsController* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_PhysicsController_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_PhysicsController_removeStatusListener(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -5,6 +5,7 @@ namespace gameplay
 {
 
 // Lua bindings for PhysicsController.
+int lua_PhysicsController_addCallback(lua_State* state);
 int lua_PhysicsController_addStatusListener(lua_State* state);
 int lua_PhysicsController_createFixedConstraint(lua_State* state);
 int lua_PhysicsController_createGenericConstraint(lua_State* state);
@@ -14,6 +15,7 @@ int lua_PhysicsController_createSpringConstraint(lua_State* state);
 int lua_PhysicsController_drawDebug(lua_State* state);
 int lua_PhysicsController_getGravity(lua_State* state);
 int lua_PhysicsController_rayTest(lua_State* state);
+int lua_PhysicsController_removeCallback(lua_State* state);
 int lua_PhysicsController_removeStatusListener(lua_State* state);
 int lua_PhysicsController_setGravity(lua_State* state);
 int lua_PhysicsController_sweepTest(lua_State* state);

+ 2 - 0
gameplay/src/lua/lua_PhysicsControllerHitFilter.cpp

@@ -8,6 +8,8 @@
 #include "PhysicsCharacter.h"
 #include "PhysicsController.h"
 #include "PhysicsRigidBody.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "lua_PhysicsControllerListenerEventType.h"
 
 namespace gameplay

+ 2 - 0
gameplay/src/lua/lua_PhysicsControllerHitResult.cpp

@@ -8,6 +8,8 @@
 #include "PhysicsCharacter.h"
 #include "PhysicsController.h"
 #include "PhysicsRigidBody.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "lua_PhysicsControllerListenerEventType.h"
 
 namespace gameplay

+ 2 - 0
gameplay/src/lua/lua_PhysicsControllerListener.cpp

@@ -8,6 +8,8 @@
 #include "PhysicsCharacter.h"
 #include "PhysicsController.h"
 #include "PhysicsRigidBody.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "lua_PhysicsControllerListenerEventType.h"
 
 namespace gameplay

+ 1 - 0
gameplay/src/lua/lua_PhysicsGhostObject.cpp

@@ -10,6 +10,7 @@
 #include "PhysicsController.h"
 #include "PhysicsGhostObject.h"
 #include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CurveInterpolationType.h"
 #include "lua_PhysicsCollisionObjectCollisionListenerEventType.h"

+ 1 - 0
gameplay/src/lua/lua_PhysicsRigidBody.cpp

@@ -12,6 +12,7 @@
 #include "PhysicsController.h"
 #include "PhysicsRigidBody.h"
 #include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CurveInterpolationType.h"
 #include "lua_PhysicsCollisionObjectCollisionListenerEventType.h"

+ 1 - 0
gameplay/src/lua/lua_PhysicsRigidBodyParameters.cpp

@@ -12,6 +12,7 @@
 #include "PhysicsController.h"
 #include "PhysicsRigidBody.h"
 #include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CurveInterpolationType.h"
 #include "lua_PhysicsCollisionObjectCollisionListenerEventType.h"

+ 88 - 0
gameplay/src/lua/lua_RadioButton.cpp

@@ -11,6 +11,8 @@
 #include "Node.h"
 #include "RadioButton.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "lua_ControlAlignment.h"
 #include "lua_ControlListenerEventType.h"
 #include "lua_ControlState.h"
@@ -24,6 +26,7 @@ void luaRegister_RadioButton()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_RadioButton_addCallback},
         {"addListener", lua_RadioButton_addListener},
         {"addRef", lua_RadioButton_addRef},
         {"createAnimation", lua_RadioButton_createAnimation},
@@ -76,6 +79,7 @@ void luaRegister_RadioButton()
         {"isEnabled", lua_RadioButton_isEnabled},
         {"isSelected", lua_RadioButton_isSelected},
         {"release", lua_RadioButton_release},
+        {"removeCallback", lua_RadioButton_removeCallback},
         {"setAlignment", lua_RadioButton_setAlignment},
         {"setAnimationPropertyValue", lua_RadioButton_setAnimationPropertyValue},
         {"setAutoHeight", lua_RadioButton_setAutoHeight},
@@ -171,6 +175,48 @@ int lua_RadioButton__gc(lua_State* state)
     return 0;
 }
 
+int lua_RadioButton_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                RadioButton* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_RadioButton_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_RadioButton_addListener(lua_State* state)
 {
     // Get the number of parameters.
@@ -2827,6 +2873,48 @@ int lua_RadioButton_release(lua_State* state)
     return 0;
 }
 
+int lua_RadioButton_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                RadioButton* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_RadioButton_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_RadioButton_setAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for RadioButton.
 int lua_RadioButton__gc(lua_State* state);
+int lua_RadioButton_addCallback(lua_State* state);
 int lua_RadioButton_addListener(lua_State* state);
 int lua_RadioButton_addRef(lua_State* state);
 int lua_RadioButton_createAnimation(lua_State* state);
@@ -58,6 +59,7 @@ int lua_RadioButton_isContainer(lua_State* state);
 int lua_RadioButton_isEnabled(lua_State* state);
 int lua_RadioButton_isSelected(lua_State* state);
 int lua_RadioButton_release(lua_State* state);
+int lua_RadioButton_removeCallback(lua_State* state);
 int lua_RadioButton_setAlignment(lua_State* state);
 int lua_RadioButton_setAnimationPropertyValue(lua_State* state);
 int lua_RadioButton_setAutoHeight(lua_State* state);

+ 156 - 0
gameplay/src/lua/lua_ScriptTarget.cpp

@@ -0,0 +1,156 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "lua_ScriptTarget.h"
+#include "Base.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
+
+namespace gameplay
+{
+
+void luaRegister_ScriptTarget()
+{
+    const luaL_Reg lua_members[] = 
+    {
+        {"addCallback", lua_ScriptTarget_addCallback},
+        {"removeCallback", lua_ScriptTarget_removeCallback},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+
+    ScriptUtil::registerClass("ScriptTarget", lua_members, NULL, lua_ScriptTarget__gc, lua_statics, scopePath);
+}
+
+static ScriptTarget* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "ScriptTarget");
+    luaL_argcheck(state, userdata != NULL, 1, "'ScriptTarget' expected.");
+    return (ScriptTarget*)((ScriptUtil::LuaObject*)userdata)->instance;
+}
+
+int lua_ScriptTarget__gc(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 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            {
+                void* userdata = luaL_checkudata(state, 1, "ScriptTarget");
+                luaL_argcheck(state, userdata != NULL, 1, "'ScriptTarget' expected.");
+                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    ScriptTarget* instance = (ScriptTarget*)object->instance;
+                    SAFE_DELETE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_ScriptTarget__gc - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_ScriptTarget_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                ScriptTarget* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_ScriptTarget_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_ScriptTarget_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                ScriptTarget* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_ScriptTarget_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+}

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

@@ -0,0 +1,16 @@
+#ifndef LUA_SCRIPTTARGET_H_
+#define LUA_SCRIPTTARGET_H_
+
+namespace gameplay
+{
+
+// Lua bindings for ScriptTarget.
+int lua_ScriptTarget__gc(lua_State* state);
+int lua_ScriptTarget_addCallback(lua_State* state);
+int lua_ScriptTarget_removeCallback(lua_State* state);
+
+void luaRegister_ScriptTarget();
+
+}
+
+#endif

+ 88 - 0
gameplay/src/lua/lua_Slider.cpp

@@ -9,6 +9,8 @@
 #include "Label.h"
 #include "Node.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Slider.h"
 #include "lua_ControlAlignment.h"
 #include "lua_ControlListenerEventType.h"
@@ -23,6 +25,7 @@ void luaRegister_Slider()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_Slider_addCallback},
         {"addListener", lua_Slider_addListener},
         {"addRef", lua_Slider_addRef},
         {"createAnimation", lua_Slider_createAnimation},
@@ -77,6 +80,7 @@ void luaRegister_Slider()
         {"isContainer", lua_Slider_isContainer},
         {"isEnabled", lua_Slider_isEnabled},
         {"release", lua_Slider_release},
+        {"removeCallback", lua_Slider_removeCallback},
         {"setAlignment", lua_Slider_setAlignment},
         {"setAnimationPropertyValue", lua_Slider_setAnimationPropertyValue},
         {"setAutoHeight", lua_Slider_setAutoHeight},
@@ -175,6 +179,48 @@ int lua_Slider__gc(lua_State* state)
     return 0;
 }
 
+int lua_Slider_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Slider* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Slider_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Slider_addListener(lua_State* state)
 {
     // Get the number of parameters.
@@ -2896,6 +2942,48 @@ int lua_Slider_release(lua_State* state)
     return 0;
 }
 
+int lua_Slider_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Slider* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Slider_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Slider_setAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for Slider.
 int lua_Slider__gc(lua_State* state);
+int lua_Slider_addCallback(lua_State* state);
 int lua_Slider_addListener(lua_State* state);
 int lua_Slider_addRef(lua_State* state);
 int lua_Slider_createAnimation(lua_State* state);
@@ -60,6 +61,7 @@ int lua_Slider_getZIndex(lua_State* state);
 int lua_Slider_isContainer(lua_State* state);
 int lua_Slider_isEnabled(lua_State* state);
 int lua_Slider_release(lua_State* state);
+int lua_Slider_removeCallback(lua_State* state);
 int lua_Slider_setAlignment(lua_State* state);
 int lua_Slider_setAnimationPropertyValue(lua_State* state);
 int lua_Slider_setAutoHeight(lua_State* state);

+ 88 - 0
gameplay/src/lua/lua_TextBox.cpp

@@ -9,6 +9,8 @@
 #include "Label.h"
 #include "Node.h"
 #include "Ref.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "TextBox.h"
 #include "lua_ControlAlignment.h"
 #include "lua_ControlListenerEventType.h"
@@ -23,6 +25,7 @@ void luaRegister_TextBox()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_TextBox_addCallback},
         {"addListener", lua_TextBox_addListener},
         {"addRef", lua_TextBox_addRef},
         {"createAnimation", lua_TextBox_createAnimation},
@@ -74,6 +77,7 @@ void luaRegister_TextBox()
         {"isContainer", lua_TextBox_isContainer},
         {"isEnabled", lua_TextBox_isEnabled},
         {"release", lua_TextBox_release},
+        {"removeCallback", lua_TextBox_removeCallback},
         {"setAlignment", lua_TextBox_setAlignment},
         {"setAnimationPropertyValue", lua_TextBox_setAnimationPropertyValue},
         {"setAutoHeight", lua_TextBox_setAutoHeight},
@@ -168,6 +172,48 @@ int lua_TextBox__gc(lua_State* state)
     return 0;
 }
 
+int lua_TextBox_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                TextBox* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_TextBox_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_TextBox_addListener(lua_State* state)
 {
     // Get the number of parameters.
@@ -2778,6 +2824,48 @@ int lua_TextBox_release(lua_State* state)
     return 0;
 }
 
+int lua_TextBox_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                TextBox* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_TextBox_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_TextBox_setAlignment(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -6,6 +6,7 @@ namespace gameplay
 
 // Lua bindings for TextBox.
 int lua_TextBox__gc(lua_State* state);
+int lua_TextBox_addCallback(lua_State* state);
 int lua_TextBox_addListener(lua_State* state);
 int lua_TextBox_addRef(lua_State* state);
 int lua_TextBox_createAnimation(lua_State* state);
@@ -57,6 +58,7 @@ int lua_TextBox_getZIndex(lua_State* state);
 int lua_TextBox_isContainer(lua_State* state);
 int lua_TextBox_isEnabled(lua_State* state);
 int lua_TextBox_release(lua_State* state);
+int lua_TextBox_removeCallback(lua_State* state);
 int lua_TextBox_setAlignment(lua_State* state);
 int lua_TextBox_setAnimationPropertyValue(lua_State* state);
 int lua_TextBox_setAutoHeight(lua_State* state);

+ 88 - 0
gameplay/src/lua/lua_Transform.cpp

@@ -6,6 +6,8 @@
 #include "Base.h"
 #include "Game.h"
 #include "Node.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CurveInterpolationType.h"
 
@@ -16,6 +18,7 @@ void luaRegister_Transform()
 {
     const luaL_Reg lua_members[] = 
     {
+        {"addCallback", lua_Transform_addCallback},
         {"addListener", lua_Transform_addListener},
         {"createAnimation", lua_Transform_createAnimation},
         {"createAnimationFromBy", lua_Transform_createAnimationFromBy},
@@ -40,6 +43,7 @@ void luaRegister_Transform()
         {"getTranslationY", lua_Transform_getTranslationY},
         {"getTranslationZ", lua_Transform_getTranslationZ},
         {"getUpVector", lua_Transform_getUpVector},
+        {"removeCallback", lua_Transform_removeCallback},
         {"removeListener", lua_Transform_removeListener},
         {"rotate", lua_Transform_rotate},
         {"rotateX", lua_Transform_rotateX},
@@ -277,6 +281,48 @@ int lua_Transform__init(lua_State* state)
     return 0;
 }
 
+int lua_Transform_addCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Transform* instance = getInstance(state);
+                instance->addCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Transform_addCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Transform_addListener(lua_State* state)
 {
     // Get the number of parameters.
@@ -1774,6 +1820,48 @@ int lua_Transform_getUpVector(lua_State* state)
     return 0;
 }
 
+int lua_Transform_removeCallback(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 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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                std::string param1 = ScriptUtil::getString(2, true);
+
+                // Get parameter 2 off the stack.
+                std::string param2 = ScriptUtil::getString(3, true);
+
+                Transform* instance = getInstance(state);
+                instance->removeCallback(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Transform_removeCallback - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
 int lua_Transform_removeListener(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -7,6 +7,7 @@ namespace gameplay
 // Lua bindings for Transform.
 int lua_Transform__gc(lua_State* state);
 int lua_Transform__init(lua_State* state);
+int lua_Transform_addCallback(lua_State* state);
 int lua_Transform_addListener(lua_State* state);
 int lua_Transform_createAnimation(lua_State* state);
 int lua_Transform_createAnimationFromBy(lua_State* state);
@@ -31,6 +32,7 @@ int lua_Transform_getTranslationX(lua_State* state);
 int lua_Transform_getTranslationY(lua_State* state);
 int lua_Transform_getTranslationZ(lua_State* state);
 int lua_Transform_getUpVector(lua_State* state);
+int lua_Transform_removeCallback(lua_State* state);
 int lua_Transform_removeListener(lua_State* state);
 int lua_Transform_rotate(lua_State* state);
 int lua_Transform_rotateX(lua_State* state);

+ 2 - 0
gameplay/src/lua/lua_TransformListener.cpp

@@ -6,6 +6,8 @@
 #include "Base.h"
 #include "Game.h"
 #include "Node.h"
+#include "ScriptController.h"
+#include "ScriptTarget.h"
 #include "Transform.h"
 #include "lua_CurveInterpolationType.h"
 

+ 1 - 0
gameplay/src/lua/lua_all_bindings.cpp

@@ -99,6 +99,7 @@ void lua_RegisterAllBindings()
     luaRegister_Scene();
     luaRegister_ScreenDisplayer();
     luaRegister_ScriptController();
+    luaRegister_ScriptTarget();
     luaRegister_Slider();
     luaRegister_SpriteBatch();
     luaRegister_Technique();

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

@@ -94,6 +94,7 @@
 #include "lua_Scene.h"
 #include "lua_ScreenDisplayer.h"
 #include "lua_ScriptController.h"
+#include "lua_ScriptTarget.h"
 #include "lua_Slider.h"
 #include "lua_SpriteBatch.h"
 #include "lua_Technique.h"