Explorar el Código

Adds gameplay-luagen project, which generates bindings from the Doxygen XML output.
Updates gameplay.doxyfile to generate the needed XML files.
Adds the initial version of the generated Lua bindings along with the ScriptController class.

Chris Culy hace 13 años
padre
commit
9f1c2652ed
Se han modificado 100 ficheros con 22995 adiciones y 207 borrados
  1. 5 1
      .gitignore
  2. 19 0
      gameplay-luagen/TODO.txt
  3. 102 0
      gameplay-luagen/gameplay-luagen.vcxproj
  4. 19 0
      gameplay-luagen/gameplay-luagen.vcxproj.filters
  5. 11 0
      gameplay-luagen/gameplay-luagen.vcxproj.user
  6. 83 0
      gameplay-luagen/src/Base.h
  7. 290 0
      gameplay-luagen/src/ClassBinding.cpp
  8. 50 0
      gameplay-luagen/src/ClassBinding.h
  9. 302 0
      gameplay-luagen/src/DebugNew.cpp
  10. 50 0
      gameplay-luagen/src/DebugNew.h
  11. 15 0
      gameplay-luagen/src/EnumBinding.h
  12. 933 0
      gameplay-luagen/src/FunctionBinding.cpp
  13. 165 0
      gameplay-luagen/src/FunctionBinding.h
  14. 1626 0
      gameplay-luagen/src/Generator.cpp
  15. 191 0
      gameplay-luagen/src/Generator.h
  16. 16 0
      gameplay-luagen/src/TypedefBinding.h
  17. 36 0
      gameplay-luagen/src/main.cpp
  18. 18 26
      gameplay.doxyfile
  19. 226 4
      gameplay/gameplay.vcxproj
  20. 726 63
      gameplay/gameplay.vcxproj.filters
  21. 1 0
      gameplay/src/AudioListener.h
  22. 3 0
      gameplay/src/Base.h
  23. 1 1
      gameplay/src/BoundingBox.cpp
  24. 0 8
      gameplay/src/BoundingSphere.h
  25. 1 1
      gameplay/src/Bundle.cpp
  26. 10 1
      gameplay/src/Container.cpp
  27. 1 10
      gameplay/src/Container.h
  28. 5 7
      gameplay/src/Control.cpp
  29. 1 10
      gameplay/src/Control.h
  30. 29 0
      gameplay/src/Curve.cpp
  31. 0 14
      gameplay/src/Curve.h
  32. 0 36
      gameplay/src/Curve.inl
  33. 1 0
      gameplay/src/FileSystem.cpp
  34. 2 0
      gameplay/src/FileSystem.h
  35. 112 2
      gameplay/src/Game.cpp
  36. 3 0
      gameplay/src/Game.h
  37. 1 0
      gameplay/src/Image.h
  38. 3 0
      gameplay/src/Light.h
  39. 3 3
      gameplay/src/Material.cpp
  40. 6 0
      gameplay/src/MaterialParameter.h
  41. 1 0
      gameplay/src/Mesh.h
  42. 1 0
      gameplay/src/MeshPart.h
  43. 1 0
      gameplay/src/Node.cpp
  44. 4 1
      gameplay/src/Node.h
  45. 5 0
      gameplay/src/ParticleEmitter.cpp
  46. 1 0
      gameplay/src/Pass.h
  47. 6 3
      gameplay/src/PhysicsCharacter.cpp
  48. 2 0
      gameplay/src/PhysicsCharacter.h
  49. 1 0
      gameplay/src/PhysicsCollisionObject.cpp
  50. 8 0
      gameplay/src/PhysicsCollisionShape.h
  51. 3 3
      gameplay/src/PhysicsController.cpp
  52. 5 1
      gameplay/src/PhysicsController.h
  53. 1 1
      gameplay/src/Properties.cpp
  54. 1 0
      gameplay/src/Properties.h
  55. 2 2
      gameplay/src/RenderState.cpp
  56. 5 5
      gameplay/src/Scene.cpp
  57. 1 0
      gameplay/src/Scene.h
  58. 2 1
      gameplay/src/SceneLoader.cpp
  59. 10 2
      gameplay/src/SceneLoader.h
  60. 621 0
      gameplay/src/ScriptController.cpp
  61. 616 0
      gameplay/src/ScriptController.h
  62. 127 0
      gameplay/src/ScriptController.inl
  63. 1 1
      gameplay/src/Texture.cpp
  64. 1 0
      gameplay/src/TimeListener.h
  65. 1 0
      gameplay/src/VertexAttributeBinding.h
  66. 5 0
      gameplay/src/VerticalLayout.cpp
  67. 217 0
      gameplay/src/lua/lua_AbsoluteLayout.cpp
  68. 18 0
      gameplay/src/lua/lua_AbsoluteLayout.h
  69. 674 0
      gameplay/src/lua/lua_Animation.cpp
  70. 27 0
      gameplay/src/lua/lua_Animation.h
  71. 1068 0
      gameplay/src/lua/lua_AnimationClip.cpp
  72. 40 0
      gameplay/src/lua/lua_AnimationClip.h
  73. 121 0
      gameplay/src/lua/lua_AnimationClipListener.cpp
  74. 15 0
      gameplay/src/lua/lua_AnimationClipListener.h
  75. 66 0
      gameplay/src/lua/lua_AnimationController.cpp
  76. 14 0
      gameplay/src/lua/lua_AnimationController.h
  77. 617 0
      gameplay/src/lua/lua_AnimationTarget.cpp
  78. 21 0
      gameplay/src/lua/lua_AnimationTarget.h
  79. 172 0
      gameplay/src/lua/lua_AnimationValue.cpp
  80. 15 0
      gameplay/src/lua/lua_AnimationValue.h
  81. 179 0
      gameplay/src/lua/lua_AudioBuffer.cpp
  82. 17 0
      gameplay/src/lua/lua_AudioBuffer.h
  83. 71 0
      gameplay/src/lua/lua_AudioController.cpp
  84. 14 0
      gameplay/src/lua/lua_AudioController.h
  85. 526 0
      gameplay/src/lua/lua_AudioListener.cpp
  86. 25 0
      gameplay/src/lua/lua_AudioListener.h
  87. 809 0
      gameplay/src/lua/lua_AudioSource.cpp
  88. 33 0
      gameplay/src/lua/lua_AudioSource.h
  89. 754 0
      gameplay/src/lua/lua_BoundingBox.cpp
  90. 25 0
      gameplay/src/lua/lua_BoundingBox.h
  91. 625 0
      gameplay/src/lua/lua_BoundingSphere.cpp
  92. 23 0
      gameplay/src/lua/lua_BoundingSphere.h
  93. 537 0
      gameplay/src/lua/lua_Bundle.cpp
  94. 25 0
      gameplay/src/lua/lua_Bundle.h
  95. 4024 0
      gameplay/src/lua/lua_Button.cpp
  96. 95 0
      gameplay/src/lua/lua_Button.h
  97. 1306 0
      gameplay/src/lua/lua_Camera.cpp
  98. 42 0
      gameplay/src/lua/lua_Camera.h
  99. 4183 0
      gameplay/src/lua/lua_CheckBox.cpp
  100. 99 0
      gameplay/src/lua/lua_CheckBox.h

+ 5 - 1
.gitignore

@@ -165,4 +165,8 @@ Thumbs.db
 /gameplay-samples/sample04-particles/android/obj
 /gameplay-samples/sample04-particles/android/proguard.cfg
 /gameplay-samples/sample04-particles/android/local.properties
-/gameplay-samples/sample04-particles/android/project.properties
+/gameplay-samples/sample04-particles/android/project.properties
+/gameplay-api/xml
+/gameplay-luagen/Release
+/gameplay-luagen/Debug
+/gameplay/android/proguard-project.txt

+ 19 - 0
gameplay-luagen/TODO.txt

@@ -0,0 +1,19 @@
+Unsupported:
+============
+- operators
+- templates
+- variable arguments
+- Lua doesn't support as many types as C++ so if there are functions that overload on parameters with types that overlap in Lua, the overloading won't work properly (i.e. char, short, int, long, float, double and all corresponding unsigned variants overlap in Lua).
+
+Normal Priority List:
+=====================
+- Notify users when they generate bindings if a binding will not work due a name clash with a reserved Lua keyword (i.e. "end").
+- Add support for object arrays (i.e. VertexElement*).
+- Add "@script{create}" to the appropriate gameplay functions.
+- Fix memory leaks in gameplay-luagen and in generated code.
+- Add support for passing function pointers (i.e. for material parameter binding) (using the same string mechanism that was used for enums?).
+
+Low Priority List:
+==================
+- Add support for std::vector.
+- Separate threads?

+ 102 - 0
gameplay-luagen/gameplay-luagen.vcxproj

@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{CA137C5D-FDE1-4095-926A-59E8472504BF}</ProjectGuid>
+    <Keyword>Win32Proj</Keyword>
+    <RootNamespace>gameplayluagen</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>GP_ERRORS_AS_WARNINGS;_ITERATOR_DEBUG_LEVEL=0;WIN32;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>C:\git\gameplay\external-deps\tinyxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalLibraryDirectories>C:\git\gameplay\external-deps\tinyxml2\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>tinyxml2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>C:\git\gameplay\external-deps\tinyxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalLibraryDirectories>C:\git\gameplay\external-deps\tinyxml2\lib\win32;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalDependencies>tinyxml2.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="FunctionBinding.cpp" />
+    <ClCompile Include="ClassBinding.cpp" />
+    <ClCompile Include="DebugNew.cpp" />
+    <ClCompile Include="Generator.cpp" />
+    <ClCompile Include="main.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Base.h" />
+    <ClInclude Include="FunctionBinding.h" />
+    <ClInclude Include="ClassBinding.h" />
+    <ClInclude Include="DebugNew.h" />
+    <ClInclude Include="EnumBinding.h" />
+    <ClInclude Include="Generator.h" />
+    <ClInclude Include="TypedefBinding.h" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 19 - 0
gameplay-luagen/gameplay-luagen.vcxproj.filters

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <ClCompile Include="main.cpp" />
+    <ClCompile Include="DebugNew.cpp" />
+    <ClCompile Include="Generator.cpp" />
+    <ClCompile Include="ClassBinding.cpp" />
+    <ClCompile Include="FunctionBinding.cpp" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="Base.h" />
+    <ClInclude Include="DebugNew.h" />
+    <ClInclude Include="ClassBinding.h" />
+    <ClInclude Include="Generator.h" />
+    <ClInclude Include="FunctionBinding.h" />
+    <ClInclude Include="EnumBinding.h" />
+    <ClInclude Include="TypedefBinding.h" />
+  </ItemGroup>
+</Project>

+ 11 - 0
gameplay-luagen/gameplay-luagen.vcxproj.user

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LocalDebuggerCommandArguments>"$(ProjectDir)../gameplay-api/xml/" "$(ProjectDir)../gameplay/src/lua/"</LocalDebuggerCommandArguments>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LocalDebuggerCommandArguments>"$(ProjectDir)../gameplay-api/xml/" "$(ProjectDir)../gameplay/src/lua/"</LocalDebuggerCommandArguments>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+</Project>

+ 83 - 0
gameplay-luagen/src/Base.h

@@ -0,0 +1,83 @@
+#include <algorithm>
+#include <cassert>
+#include <fstream>
+#include <iostream>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+using namespace std;
+
+#define LUA_GLOBAL_FILENAME "lua_Global"
+#define LUA_ALL_BINDINGS_FILENAME "lua_all_bindings"
+#define LUA_OBJECT "ScriptController::LuaObject"
+#define SCOPE_REPLACEMENT ""
+#define SCOPE_REPLACEMENT_SIZE strlen(SCOPE_REPLACEMENT)
+#define REF_CLASS_NAME "Ref"
+#define REMOVE_NAMESPACE true
+
+#ifdef WIN32
+#include <windows.h>
+#pragma warning(disable : 4996)
+#pragma warning(disable : 4244)
+#pragma warning(disable : 4345)
+#endif
+
+// Object deletion macro
+#define SAFE_DELETE(x) \
+    { \
+        delete x; \
+        x = NULL; \
+    }
+
+// Array deletion macro
+#define SAFE_DELETE_ARRAY(x) \
+    { \
+        delete[] x; \
+        x = NULL; \
+    }
+
+extern void printError(const char* format, ...);
+
+// Current function macro.
+#ifdef WIN32
+#define __current__func__ __FUNCTION__
+#else
+#define __current__func__ __func__
+#endif
+
+// Assert macros.
+#ifdef _DEBUG
+#define GP_ASSERT(expression) do { \
+    if (!(expression)) \
+    { \
+        printError("%s -- Assertion '" #expression "' failed.\n", __current__func__); \
+        assert(expression); \
+    } } while (0)
+#else
+#define GP_ASSERT(expression)
+#endif
+
+// Error macro.
+#ifdef GP_ERRORS_AS_WARNINGS
+#define GP_ERROR GP_WARN
+#else
+#define GP_ERROR(...) do \
+    { \
+        printError("%s -- ", __current__func__); \
+        printError(__VA_ARGS__); \
+        printError("\n"); \
+        assert(0); \
+        std::exit(-1); \
+    } while (0)
+#endif
+
+// Warning macro.
+#define GP_WARN(...) do \
+    { \
+        printError("%s -- ", __current__func__); \
+        printError(__VA_ARGS__); \
+        printError("\n"); \
+    } while (0)
+
+#include "DebugNew.h"

+ 290 - 0
gameplay-luagen/src/ClassBinding.cpp

@@ -0,0 +1,290 @@
+#include "ClassBinding.h"
+#include "Generator.h"
+
+static void generateInstanceGetter(ostream& o, const string& classname, const string& uniquename)
+{
+    o << "static " << classname << "* getInstance(lua_State* state)\n";
+    o << "{\n";
+    o << "    void* userdata = luaL_checkudata(state, 1, \"" << uniquename << "\");\n";
+    o << "    luaL_argcheck(state, userdata != NULL, 1, \"\'" << uniquename << "\' expected.\");\n";
+    o << "    return (" << classname << "*)((" << LUA_OBJECT << "*)userdata)->instance;\n";
+    o << "}\n\n";
+}
+
+ClassBinding::ClassBinding(string classname, string refId) : classname(classname),
+    refId(refId), inaccessibleConstructor(false), inaccessibleDestructor(false)
+{
+    // If specified, remove the namespace from the class name.
+    if (REMOVE_NAMESPACE)
+    {
+        this->classname = Generator::getInstance()->getClassNameWithoutNamespace(classname);
+    }
+
+    // Calculate the unique name for the class.
+    uniquename = Generator::getUniqueName(this->classname);
+}
+
+void ClassBinding::write(string dir, string* bindingNS)
+{
+    // Calculate the constructor string.
+    size_t index = uniquename.rfind(SCOPE_REPLACEMENT);
+    string constructorString = "";
+    string* constructorUniqueName = NULL;
+    if (index != uniquename.npos && index != uniquename.length())
+        constructorString += uniquename.substr(index + SCOPE_REPLACEMENT_SIZE);
+    else
+        constructorString += uniquename;
+
+    // Generate a constructor function if there isn't one
+    // and the class doesn't have an inaccessible constructor.
+    FunctionBinding b(classname, uniquename);
+    b.name = constructorString;
+    b.returnParam = FunctionBinding::Param(FunctionBinding::Param::TYPE_CONSTRUCTOR, FunctionBinding::Param::KIND_POINTER, refId);
+    b.type = FunctionBinding::MEMBER_FUNCTION;
+    b.own = true;
+
+    map<string, vector<FunctionBinding> >::iterator iter = bindings.find(b.getFunctionName());
+    if (iter == bindings.end())
+    {
+        if (!inaccessibleConstructor)
+        {
+            bindings[b.getFunctionName()].push_back(b);
+            constructorUniqueName = new string(b.getFunctionName());
+        }
+    }
+    else
+    {
+        constructorUniqueName = new string(iter->second[0].getFunctionName());
+    }
+
+    // Calculate the destructor string.
+    index = uniquename.rfind(SCOPE_REPLACEMENT);
+    string destructorString = "~";
+    string* destructorUniqueName = NULL;
+    if (index != uniquename.npos && index != uniquename.length())
+        destructorString += uniquename.substr(index + SCOPE_REPLACEMENT_SIZE);
+    else
+        destructorString += uniquename;
+
+    // Generate a destructor function if there isn't one
+    // and the class doesn't have an inaccessible destructor
+    // or the class is derived from Ref.
+    b = FunctionBinding(classname, uniquename);
+    b.name = destructorString;
+    b.returnParam = FunctionBinding::Param(FunctionBinding::Param::TYPE_DESTRUCTOR);
+    b.type = FunctionBinding::MEMBER_FUNCTION;
+
+    iter = bindings.find(b.getFunctionName());
+    if (iter == bindings.end())
+    {
+        if (!inaccessibleDestructor || Generator::getInstance()->isRef(classname))
+        {
+            bindings[b.getFunctionName()].push_back(b);
+            destructorUniqueName = new string(b.getFunctionName());
+        }
+    }
+    else
+    {
+        destructorUniqueName = new string(iter->second[0].getFunctionName());
+    }
+
+    // Write out the header.
+    {
+        string path = dir + string("lua_") + uniquename + string(".h");
+        ofstream o(path);
+        if (!o)
+        {
+            GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str());
+            return;
+        }
+
+        string includeGuard = string("lua_") + uniquename + string("_H_");
+        transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper);
+        o << "#ifndef " << includeGuard << "\n";
+        o << "#define " << includeGuard << "\n\n";
+
+        if (bindingNS)
+        {
+            o << "namespace " << *bindingNS << "\n";
+            o << "{\n\n";
+        }
+
+        o << "// Lua bindings for " << classname << ".\n";
+            
+        // Write out the binding functions declarations.
+        iter = bindings.begin();
+        for (; iter != bindings.end(); iter++)
+        {
+            o << "int " << iter->second[0].getFunctionName() << "(lua_State* state);\n";
+        }
+        o << "\n";
+
+        // Write out the signature of the function used to register the class with Lua.
+        o << "void luaRegister_" << uniquename << "();\n\n";
+
+        if (bindingNS)
+            o << "}\n\n";
+        o << "#endif\n";
+        o.close();
+    }
+
+    // Write out the implementation.
+    {
+        string path = dir + string("lua_") + uniquename + string(".cpp");
+        ofstream o(path);
+        if (!o)
+        {
+            GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str());
+            return;
+        }
+        
+        o << "#include \"Base.h\"\n";
+        o << "#include \"ScriptController.h\"\n";
+        o << "#include \"" << include << "\"\n";
+        o << "#include \"lua_" << uniquename << ".h\"\n";
+        o << "#include \"" << LUA_GLOBAL_FILENAME << ".h\"\n\n";
+        
+        // If the original class is part of a namespace and we aren't generating into that namespace,
+        // include its member with a 'using' statement.
+        if (ns.length() > 0 && (!bindingNS || (*bindingNS != ns)))
+        {
+            o << "using " << ns << ";\n\n";
+        }
+
+        if (bindingNS)
+        {
+            o << "namespace " << *bindingNS << "\n";
+            o << "{\n\n";
+        }
+
+        // Write out the function used to register the class with Lua.
+        o << "void luaRegister_" << uniquename << "()\n";
+        o << "{\n";
+        o << "    ScriptController* sc = ScriptController::getInstance();\n\n";
+        
+        // Get the member functions ready to bind.
+        iter = bindings.begin();
+        bool hasMembers = false;
+        for (; iter != bindings.end(); iter++)
+        {
+            for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+            {
+                if (iter->second[i].type == FunctionBinding::MEMBER_FUNCTION ||
+                    iter->second[i].type == FunctionBinding::MEMBER_CONSTANT ||
+                    iter->second[i].type == FunctionBinding::MEMBER_VARIABLE)
+                {
+                    hasMembers = true;
+                    break;
+                }
+            }
+
+            if (hasMembers)
+                break;
+        }
+        if (hasMembers)
+        {
+            o << "    const luaL_Reg lua_members[] = \n";
+            o << "    {\n";
+            iter = bindings.begin();
+            for (; iter != bindings.end(); iter++)
+            {
+                for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+                {
+                    if ((iter->second[i].type == FunctionBinding::MEMBER_FUNCTION ||
+                        iter->second[i].type == FunctionBinding::MEMBER_CONSTANT ||
+                        iter->second[i].type == FunctionBinding::MEMBER_VARIABLE) &&
+                        iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR &&
+                        iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_DESTRUCTOR)
+                    {
+                        o << "        {\"" << iter->second[i].name << "\", " << iter->second[i].getFunctionName() << "},\n";
+                        break;
+                    }
+                }
+            }
+            o << "        {NULL, NULL}\n";
+            o << "    };\n";
+        }
+        else
+        {
+            o << "    const luaL_Reg* lua_members = NULL;\n";
+        }
+
+        // Get the static functions ready to bind.
+        iter = bindings.begin();
+        bool hasStatics = false;
+        for (; iter != bindings.end(); iter++)
+        {
+            for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+            {
+                if (iter->second[i].type == FunctionBinding::STATIC_FUNCTION ||
+                    iter->second[i].type == FunctionBinding::STATIC_CONSTANT ||
+                    iter->second[i].type == FunctionBinding::STATIC_VARIABLE)
+                {
+                    hasStatics = true;
+                    break;
+                }
+            }
+
+            if (hasStatics)
+                break;
+        }
+        if (hasStatics)
+        {
+            o << "    const luaL_Reg lua_statics[] = \n";
+            o << "    {\n";
+            iter = bindings.begin();
+            for (; iter != bindings.end(); iter++)
+            {
+                for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+                {
+                    if (iter->second[i].type == FunctionBinding::STATIC_FUNCTION ||
+                    iter->second[i].type == FunctionBinding::STATIC_CONSTANT ||
+                    iter->second[i].type == FunctionBinding::STATIC_VARIABLE)
+                    {
+                        o << "        {\"" << iter->second[i].name << "\", " << iter->second[i].getFunctionName() << "},\n";
+                        break;
+                    }
+                }
+            }
+            o << "        {NULL, NULL}\n";
+            o << "    };\n";
+        }
+        else
+        {
+            o << "    const luaL_Reg* lua_statics = NULL;\n";
+        }
+
+        // Output the scope path for the class (used for inner classes).
+        vector<string> scopePath = Generator::getScopePath(classname, ns);
+        o << "    std::vector<std::string> scopePath;\n";
+        for (vector<string>::iterator scopeIter = scopePath.begin(); scopeIter != scopePath.end(); scopeIter++)
+        {
+            o << "    scopePath.push_back(\"" << *scopeIter << "\");\n";
+        }
+
+        // Register the class (its member and static functions and constructor and destructor).
+        o << "\n    sc->registerClass(\"" << uniquename << "\", lua_members, ";
+        o << ((constructorUniqueName) ? *constructorUniqueName : "NULL") << ", ";
+        o << ((destructorUniqueName) ? *destructorUniqueName : "NULL") << ", ";
+        o << "lua_statics, scopePath);\n";
+        o << "}\n\n";
+
+        // Write out the function used to get the instance for
+        // calling member functions and variables.
+        generateInstanceGetter(o, classname, uniquename);
+
+        // Write out the binding functions.
+        iter = bindings.begin();
+        for (; iter != bindings.end(); iter++)
+        {
+            FunctionBinding::write(o, iter->second);
+        }
+
+        if (bindingNS)
+            o << "}\n";
+        o.close();
+    }
+
+    SAFE_DELETE(constructorUniqueName);
+    SAFE_DELETE(destructorUniqueName);
+}

+ 50 - 0
gameplay-luagen/src/ClassBinding.h

@@ -0,0 +1,50 @@
+#ifndef CLASSBINDING_H_
+#define CLASSBINDING_H_
+
+#include "Base.h"
+#include "FunctionBinding.h"
+
+/**
+ * Represents the script binding for a class.
+ */
+struct ClassBinding
+{
+    /**
+     * Constructor.
+     * 
+     * @param classname The name of the class.
+     * @param refId The reference ID for the class (generated by Doxygen).
+     */
+    ClassBinding(string classname = "", string refId = "");
+
+    /**
+     * Writes out the generated Lua bindings in C++ to the given directory.
+     * 
+     * @param dir The directory to write the bindings files (.h and .cpp) to.
+     * @param bindingNS The namespace to generate the Lua bindings within.
+     */
+    void write(string dir, string* bindingNS = NULL);
+
+    /** Holds all the public function bindings of the class. */
+    map<string, vector<FunctionBinding> > bindings;
+    /** Holds bindings for hidden functions of the class (protected/private). */
+    map<string, vector<FunctionBinding> > hidden;
+    /** Holds the name(s) of the derived class(es). */
+    vector<string> derived;
+    /** Holds the name of the class. */
+    string classname;
+    /** Holds the class's unique name (used only in the script bindings). */
+    string uniquename;
+    /** Holds the class's (Doxygen-generated) reference id. */
+    string refId;
+    /** Holds the needed include for the original class declaration. */
+    string include;
+    /** Holds whether the class has an inaccessible (protected/private) constructor (or has a pure-virtual method). */
+    bool inaccessibleConstructor;
+    /** Holds whether the class has an inaccessible (protected/private) destructor. */
+    bool inaccessibleDestructor;
+    /** Holds the class' namespace (if it has one). */
+    string ns;
+};
+
+#endif

+ 302 - 0
gameplay-luagen/src/DebugNew.cpp

@@ -0,0 +1,302 @@
+#include <new>
+#include <exception>
+#include <cstdio>
+#include <cstdarg>
+
+#ifdef WIN32
+#include <windows.h>
+#include <dbghelp.h>
+#pragma comment(lib,"dbghelp.lib")
+
+#define MAX_STACK_FRAMES 16
+bool __trackStackTrace = false;
+#endif
+
+struct MemoryAllocationRecord
+{
+    unsigned long address;          // address returned to the caller after allocation
+    unsigned int size;              // size of the allocation request
+    const char* file;               // source file of allocation request
+    int line;                       // source line of the allocation request
+    MemoryAllocationRecord* next;
+    MemoryAllocationRecord* prev;
+#ifdef WIN32
+    bool trackStackTrace;
+    unsigned int pc[MAX_STACK_FRAMES];
+#endif
+};
+
+MemoryAllocationRecord* __memoryAllocations = 0;
+int __memoryAllocationCount = 0;
+
+void* debugAlloc(std::size_t size, const char* file, int line);
+void debugFree(void* p);
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 )
+#endif
+
+void* operator new (std::size_t size, const char* file, int line)
+{
+    return debugAlloc(size, file, line);
+}
+
+void* operator new[] (std::size_t size, const char* file, int line)
+{
+    return operator new (size, file, line);
+}
+
+void* operator new (std::size_t size) throw(std::bad_alloc)
+{
+    return operator new (size, "", 0);
+}
+
+void* operator new[] (std::size_t size) throw(std::bad_alloc)
+{
+    return operator new (size, "", 0);
+}
+
+void* operator new (std::size_t size, const std::nothrow_t&) throw()
+{
+    return operator new (size, "", 0);
+}
+
+void* operator new[] (std::size_t size, const std::nothrow_t&) throw()
+{
+    return operator new (size, "", 0);
+}
+
+void operator delete (void* p) throw()
+{
+    debugFree(p);
+}
+
+void operator delete[] (void* p) throw()
+{
+    operator delete (p);
+}
+
+void operator delete (void* p, const char* file, int line) throw()
+{
+    operator delete (p);
+}
+
+void operator delete[] (void* p, const char* file, int line) throw()
+{
+    operator delete (p);
+}
+
+#ifdef _MSC_VER
+#pragma warning( default : 4290 )
+#endif
+
+// Include Base.h (needed for logging macros) AFTER new operator impls
+#include "Base.h"
+
+void* debugAlloc(std::size_t size, const char* file, int line)
+{
+    // Allocate memory + size for a MemoryAlloctionRecord
+    unsigned char* mem = (unsigned char*)malloc(size + sizeof(MemoryAllocationRecord));
+
+    MemoryAllocationRecord* rec = (MemoryAllocationRecord*)mem;
+
+    // Move memory pointer past record
+    mem += sizeof(MemoryAllocationRecord);
+
+    rec->address = (unsigned long)mem;
+    rec->size = size;
+    rec->file = file;
+    rec->line = line;
+    rec->next = __memoryAllocations;
+    rec->prev = 0;
+
+    // Capture the stack frame (up to MAX_STACK_FRAMES) if we 
+    // are running on Windows and the user has enabled it.
+#if defined(WIN32)
+    rec->trackStackTrace = __trackStackTrace;
+    if (rec->trackStackTrace)
+    {
+        static bool initialized = false;
+        if (!initialized)
+        {
+            if (!SymInitialize(GetCurrentProcess(), NULL, true))
+                printError("Stack trace tracking will not work.\n");
+            initialized = true;
+        }
+    
+        // Get the current context (state of EBP, EIP, ESP registers).
+        static CONTEXT context;
+        RtlCaptureContext(&context);
+    
+        static STACKFRAME64 stackFrame;
+        memset(&stackFrame, 0, sizeof(STACKFRAME64));
+
+        // Initialize the stack frame based on the machine architecture.
+#ifdef _M_IX86
+        static const DWORD machineType = IMAGE_FILE_MACHINE_I386;
+        stackFrame.AddrPC.Offset = context.Eip;
+        stackFrame.AddrPC.Mode = AddrModeFlat;
+        stackFrame.AddrFrame.Offset = context.Ebp;
+        stackFrame.AddrFrame.Mode = AddrModeFlat;
+        stackFrame.AddrStack.Offset = context.Esp;
+        stackFrame.AddrStack.Mode = AddrModeFlat;
+#else
+#error "Machine architecture not supported!"
+#endif
+
+        // Walk up the stack and store the program counters.
+        memset(rec->pc, 0, sizeof(rec->pc));
+        for (int i = 0; i < MAX_STACK_FRAMES; i++)
+        {
+            rec->pc[i] = stackFrame.AddrPC.Offset;
+            if (!StackWalk64(machineType, GetCurrentProcess(), GetCurrentThread(), &stackFrame,
+                &context, NULL, SymFunctionTableAccess64, SymGetModuleBase64, NULL))
+            {
+                break;
+            }
+        }
+    }
+#endif
+
+    if (__memoryAllocations)
+        __memoryAllocations->prev = rec;
+    __memoryAllocations = rec;
+    ++__memoryAllocationCount;
+
+    return mem;
+}
+
+void debugFree(void* p)
+{
+    if (p == 0)
+        return;
+
+    // Backup passed in pointer to access memory allocation record
+    void* mem = ((unsigned char*)p) - sizeof(MemoryAllocationRecord);
+
+    MemoryAllocationRecord* rec = (MemoryAllocationRecord*)mem;
+
+    // Sanity check: ensure that address in record matches passed in address
+    if (rec->address != (unsigned long)p)
+    {
+        printError("[memory] CORRUPTION: Attempting to free memory address with invalid memory allocation record.\n");
+        return;
+    }
+
+    // Link this item out
+    if (__memoryAllocations == rec)
+        __memoryAllocations = rec->next;
+    if (rec->prev)
+        rec->prev->next = rec->next;
+    if (rec->next)
+        rec->next->prev = rec->prev;
+    --__memoryAllocationCount;
+
+    // Free the address from the original alloc location (before mem allocation record)
+    free(mem);
+}
+
+#ifdef WIN32
+void printStackTrace(MemoryAllocationRecord* rec)
+{
+    const unsigned int bufferSize = 512;
+
+    // Resolve the program counter to the corresponding function names.
+    unsigned int pc;
+    for (int i = 0; i < MAX_STACK_FRAMES; i++)
+    {
+        // Check to see if we are at the end of the stack trace.
+        pc = rec->pc[i];
+        if (pc == 0)
+            break;
+
+        // Get the function name.
+        unsigned char buffer[sizeof(IMAGEHLP_SYMBOL64) + bufferSize];
+        IMAGEHLP_SYMBOL64* symbol = (IMAGEHLP_SYMBOL64*)buffer;
+        DWORD64 displacement;
+        memset(symbol, 0, sizeof(IMAGEHLP_SYMBOL64) + bufferSize);
+        symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64);
+        symbol->MaxNameLength = bufferSize;
+        if (!SymGetSymFromAddr64(GetCurrentProcess(), pc, &displacement, symbol))
+        {
+            printError("[memory] STACK TRACE: <unknown location>\n");
+        }
+        else
+        {
+            symbol->Name[bufferSize - 1] = '\0';
+
+            // Check if we need to go further up the stack.
+            if (strncmp(symbol->Name, "operator new", 12) == 0)
+            {
+                // In operator new or new[], keep going...
+            }
+            else
+            {
+                // Get the file and line number.
+                if (pc != 0)
+                {
+                    IMAGEHLP_LINE64 line;
+                    DWORD displacement;
+                    memset(&line, 0, sizeof(line));
+                    line.SizeOfStruct = sizeof(line);
+                    if (!SymGetLineFromAddr64(GetCurrentProcess(), pc, &displacement, &line))
+                    {
+                        printError("[memory] STACK TRACE: %s - <unknown file>:<unknown line number>\n", symbol->Name);
+                    }
+                    else
+                    {
+                        const char* file = strrchr(line.FileName, '\\');
+                        if(!file) 
+                            file = line.FileName;
+                        else
+                            file++;
+                        
+                        printError("[memory] STACK TRACE: %s - %s:%d\n", symbol->Name, file, line.LineNumber);
+                    }
+                }
+            }
+        }
+    }
+}
+#endif
+
+extern void printMemoryLeaks()
+{
+    // Dump general heap memory leaks
+    if (__memoryAllocationCount == 0)
+    {
+        printError("[memory] All HEAP allocations successfully cleaned up (no leaks detected).\n");
+    }
+    else
+    {
+        printError("[memory] WARNING: %d HEAP allocations still active in memory.\n", __memoryAllocationCount);
+        MemoryAllocationRecord* rec = __memoryAllocations;
+        while (rec)
+        {
+#ifdef WIN32
+            if (rec->trackStackTrace)
+            {
+                printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d:\n", rec->address, rec->size);
+                printStackTrace(rec);
+            }
+            else
+                printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
+#else
+            gameplay::printError("[memory] LEAK: HEAP allocation leak at address %#x of size %d from line %d in file '%s'.\n", rec->address, rec->size, rec->line, rec->file);
+#endif
+            rec = rec->next;
+        }
+    }
+}
+
+#if defined(WIN32)
+void setTrackStackTrace(bool trackStackTrace)
+{
+    __trackStackTrace = trackStackTrace;
+}
+
+void toggleTrackStackTrace()
+{
+    __trackStackTrace = !__trackStackTrace;
+}
+#endif

+ 50 - 0
gameplay-luagen/src/DebugNew.h

@@ -0,0 +1,50 @@
+#ifndef DEBUGNEW_H_
+#define DEBUGNEW_H_
+
+#include <new>
+#include <exception>
+
+#define TRACK_MEMORY() \
+    static struct MemoryTrackerClass { ~MemoryTrackerClass() { printMemoryLeaks(); system("pause"); } } m
+
+// Prints all heap and reference leaks to stderr.
+extern void printMemoryLeaks();
+
+// global new/delete operator overloads
+#ifdef _MSC_VER
+#pragma warning( disable : 4290 ) // C++ exception specification ignored.
+#endif
+void* operator new (std::size_t size, const char* file, int line);
+void* operator new[] (std::size_t size, const char* file, int line);
+void* operator new (std::size_t size) throw(std::bad_alloc);
+void* operator new[] (std::size_t size) throw(std::bad_alloc);
+void* operator new (std::size_t size, const std::nothrow_t&) throw();
+void* operator new[] (std::size_t size, const std::nothrow_t&) throw();
+void operator delete (void* p) throw();
+void operator delete[] (void* p) throw();
+void operator delete (void* p, const char* file, int line) throw();
+void operator delete[] (void* p, const char* file, int line) throw();
+#ifdef _MSC_VER
+#pragma warning( default : 4290 )
+#endif
+
+// Re-define new to use versions with file and line number
+#define DEBUG_NEW new (__FILE__, __LINE__)
+#define new DEBUG_NEW
+
+#endif
+
+#if defined(WIN32)
+
+/**
+ * Sets whether stack traces are tracked on memory allocations or not.
+ * 
+ * @param trackStackTrace Whether to track the stack trace on memory allocations.
+ */
+void setTrackStackTrace(bool trackStackTrace);
+
+/**
+ * Toggles stack trace tracking on memory allocations.
+ */
+void toggleTrackStackTrace();
+#endif

+ 15 - 0
gameplay-luagen/src/EnumBinding.h

@@ -0,0 +1,15 @@
+#ifndef ENUMBINDING_H
+#define ENUMBINDING_H
+
+#include "Base.h"
+
+/**
+ * Represents a script binding for an enumeration.
+ */
+struct EnumBinding
+{
+    vector<string> values;
+    vector<string> scopePath;
+};
+
+#endif

+ 933 - 0
gameplay-luagen/src/FunctionBinding.cpp

@@ -0,0 +1,933 @@
+#include "FunctionBinding.h"
+#include "Generator.h"
+
+
+// Helper functions.
+static inline string getLuaTypeString(const FunctionBinding::Param& p = 
+    FunctionBinding::Param(FunctionBinding::Param::TYPE_OBJECT, FunctionBinding::Param::KIND_POINTER));
+static inline void indent(ostream& o, int indentLevel);
+static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel);
+static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, int i, int indentLevel, bool offsetIndex = false);
+static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel);
+static inline void outputReturnValue(ostream& o, const FunctionBinding& b, int indentLevel);
+
+
+FunctionBinding::Param::Param(FunctionBinding::Param::Type type, Kind kind, const string& info) : 
+    type(type), kind(kind), info(info), hasDefaultValue(false)
+{
+}
+
+bool FunctionBinding::Param::operator==(const Param& p) const
+{
+    return this->type == p.type && this->kind == p.kind && this->info == p.info;
+}
+
+bool FunctionBinding::Param::operator!=(const Param& p) const
+{
+    return !(*this == p);
+}
+
+FunctionBinding::FunctionBinding(string classname, string uniquename) : classname(classname), uniquename(uniquename), name(""), own(false)
+{
+}
+
+string FunctionBinding::getFunctionName() const
+{
+    if (functionName.length() == 0)
+    {
+        functionName = "lua_";
+        functionName += uniquename;
+    
+        if (type == STATIC_FUNCTION ||
+            type == STATIC_CONSTANT ||
+            type == STATIC_VARIABLE)
+            functionName += "_static";
+        functionName += "_";
+
+        if (returnParam.type == Param::TYPE_CONSTRUCTOR)
+            functionName += "_init";
+        else if (returnParam.type == Param::TYPE_DESTRUCTOR)
+            functionName += "_gc";
+        else
+            functionName += name;
+    }
+
+    return functionName;
+}
+
+unsigned int FunctionBinding::getMinParamCount() const
+{
+    for (unsigned int i = 0; i < paramTypes.size(); i++)
+    {
+        if (paramTypes[i].hasDefaultValue)
+            return i;
+    }
+    return paramTypes.size();
+}
+
+void FunctionBinding::write(ostream& o, const vector<FunctionBinding>& bindings)
+{
+    GP_ASSERT(bindings.size() > 0);
+
+    // Print the function signature.
+    o << "int " << bindings[0].getFunctionName() << "(lua_State* state)\n";
+    o << "{\n";
+
+    if (bindings.size() == 1 && bindings[0].type == FunctionBinding::MEMBER_VARIABLE)
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 2)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 1 or 2).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Get or set the member variable depending on the number of parameters.
+        o << "    " << bindings[0].classname << "* instance = getInstance(state);\n";
+        o << "    if (lua_gettop(state) == 2)\n";
+        o << "    {\n";
+        outputGetParam(o, bindings[0].returnParam, 1, 2);
+
+        if (bindings[0].returnParam.kind == FunctionBinding::Param::KIND_POINTER &&
+            bindings[0].returnParam.type != FunctionBinding::Param::TYPE_OBJECT &&
+            bindings[0].returnParam.info.size() > 0)
+        {
+            o << "        memcpy(instance->" << bindings[0].name << ", param2, sizeof(";
+            o << FunctionBinding::Param(bindings[0].returnParam.type) << ") * " << bindings[0].returnParam.info << ");\n";
+        }
+        else
+        {
+            o << "        instance->" << bindings[0].name << " = ";
+            if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT &&
+                bindings[0].returnParam.kind != FunctionBinding::Param::KIND_POINTER)
+            {
+                o << "*";
+            }
+            o << "param2;\n";
+        }
+
+        o << "        return 0;\n";
+        o << "    }\n";
+        o << "    else\n";
+        o << "    {\n";
+        
+        // Pass the return value back to Lua.
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            o << "        " << LUA_OBJECT << "* object = (" << LUA_OBJECT << "*)lua_newuserdata(state, sizeof(" << LUA_OBJECT << "));\n";
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "        object->instance = (void*)instance->" << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "        object->instance = (void*)new " << bindings[0].returnParam << "(instance->" << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "        object->instance = (void*)&(instance->" << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "        " << bindings[0].returnParam << " result = instance->" << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 2);
+        o << "    }\n";
+        o << "}\n\n";
+    }
+    else if (bindings.size() == 1 && 
+        (bindings[0].type == FunctionBinding::STATIC_VARIABLE ||
+        bindings[0].type == FunctionBinding::GLOBAL_VARIABLE))
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 1)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 0 or 1).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Get or set the static variable depending on the number of parameters.
+        o << "    if (lua_gettop(state) == 1)\n";
+        o << "    {\n";
+        outputGetParam(o, bindings[0].returnParam, 0, 2);
+
+        if (bindings[0].returnParam.kind == FunctionBinding::Param::KIND_POINTER &&
+            bindings[0].returnParam.type != FunctionBinding::Param::TYPE_OBJECT &&
+            bindings[0].returnParam.info.size() > 0)
+        {
+            o << "        memcpy(";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << ", param1, sizeof(";
+            o << FunctionBinding::Param(bindings[0].returnParam.type) << ") * " << bindings[0].returnParam.info << ");\n";
+        }
+        else
+        {
+            o << "        ";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << " = ";
+            if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT &&
+                bindings[0].returnParam.kind != FunctionBinding::Param::KIND_POINTER)
+            {
+                o << "*";
+            }
+            o << "param1;\n";
+        }
+        o << "        return 0;\n";
+        o << "    }\n";
+        o << "    else\n";
+        o << "    {\n";
+        
+        // Pass the return value back to Lua.
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            o << "        " << LUA_OBJECT << "* object = (" << LUA_OBJECT << "*)lua_newuserdata(state, sizeof(" << LUA_OBJECT << "));\n";
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "        object->instance = (void*)";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "        object->instance = (void*)new " << bindings[0].returnParam << "(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "        object->instance = (void*)&(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "        " << bindings[0].returnParam << " result = ";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 2);
+        o << "    }\n";
+        o << "}\n\n";
+    }
+    else if (bindings.size() == 1 && bindings[0].type == FunctionBinding::MEMBER_CONSTANT)
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 1)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 1).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Pass the return value back to Lua.
+        o << "    " << bindings[0].classname << "* instance = getInstance(state);\n";
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            o << "    " << LUA_OBJECT << "* object = (" << LUA_OBJECT << "*)lua_newuserdata(state, sizeof(" << LUA_OBJECT << "));\n";
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "    object->instance = (void*)instance->" << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "    object->instance = (void*)new " << bindings[0].returnParam << "(instance->" << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "    object->instance = (void*)&(instance->" << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "    " << bindings[0].returnParam << " result = instance->" << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 1);
+        o << "}\n\n";
+    }
+    else if (bindings.size() == 1 && 
+        (bindings[0].type == FunctionBinding::STATIC_CONSTANT ||
+        bindings[0].type == FunctionBinding::GLOBAL_CONSTANT))
+    {
+        // Validate the parameter count.
+        o << "    // Validate the number of parameters.\n";
+        o << "    if (lua_gettop(state) > 0)\n";
+        o << "    {\n";
+        o << "        lua_pushstring(state, \"Invalid number of parameters (expected 0).\");\n";
+        o << "        lua_error(state);\n";
+        o << "    }\n\n";
+        
+        // Pass the return value back to Lua.
+        if (bindings[0].returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            o << "    " << LUA_OBJECT << "* object = (" << LUA_OBJECT << "*)lua_newuserdata(state, sizeof(" << LUA_OBJECT << "));\n";
+            switch (bindings[0].returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "    object->instance = (void*)";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ";\n";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "    object->instance = (void*)new " << bindings[0].returnParam << "(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "    object->instance = (void*)&(";
+                if (bindings[0].classname.size() > 0)
+                    o << bindings[0].classname << "::";
+                o << bindings[0].name << ");\n";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", bindings[0].returnParam.kind);
+                break;
+            }
+        }
+        else
+        {
+            o << "    " << bindings[0].returnParam << " result = ";
+            if (bindings[0].classname.size() > 0)
+                o << bindings[0].classname << "::";
+            o << bindings[0].name << ";\n";
+        }
+        outputReturnValue(o, bindings[0], 1);
+        o << "}\n\n";
+    }
+    else
+    {
+        // Get all valid parameter counts.
+        unsigned int paramCountOffset;
+        map<unsigned int, vector<const FunctionBinding*> > paramCounts;
+        for (unsigned int i = 0, count = bindings.size(); i < count; i++)
+        {
+            unsigned int minParamCount = bindings[i].getMinParamCount();
+            paramCountOffset = (bindings[i].type == FunctionBinding::MEMBER_FUNCTION && bindings[i].returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR) ? 1 : 0;
+            paramCounts[minParamCount + paramCountOffset].push_back(&bindings[i]);
+
+            if (minParamCount < bindings[i].paramTypes.size())
+            {
+                for (unsigned int c = minParamCount + 1; c <= bindings[i].paramTypes.size(); c++)
+                {
+                    paramCounts[c + paramCountOffset].push_back(&bindings[i]);
+                }
+            }
+        }
+        
+        // Get the parameter count.
+        o << "    // Get the number of parameters.\n";
+        o << "    int paramCount = lua_gettop(state);\n\n";
+        
+        // Retrieve all the parameters and attempt to match them to a valid binding,
+        // notifying the user if the number of parameters is invalid.
+        o << "    // Attempt to match the parameters to a valid binding.\n";
+        o << "    switch (paramCount)\n";
+        o << "    {\n";
+        map<unsigned int, vector<const FunctionBinding*> >::iterator iter;
+        unsigned int checkCount = 0;
+        for (iter = paramCounts.begin(); iter != paramCounts.end(); iter++)
+        {
+            o << "        case " << iter->first << ":\n";
+            o << "        {\n";
+
+            for (unsigned int i = 0, count = iter->second.size(); i < count; i++)
+            {
+                // Only indent if there are parameters.
+                if (iter->first > 0)
+                    indent(o, 3);
+
+                if (i > 0)
+                {                    
+                    o << "else ";
+                }
+                outputMatchedBinding(o, *(iter->second[i]), iter->first, 3);
+            }
+
+            // Only print an else clause with error report if there are parameters.
+            if (iter->first > 0)
+            {
+                indent(o, 3);
+                o << "else\n";
+                indent(o, 3);
+                o << "{\n";
+                indent(o, 4);
+                o << "lua_pushstring(state, \"Failed to match the given parameters to a valid function signature.\");\n";
+                indent(o, 4);
+                o << "lua_error(state);\n";
+                indent(o, 3);
+                o << "}\n";
+            }
+            
+            o << "            break;\n";
+            o << "        }\n";
+        }
+        
+        o << "        default:\n";
+        o << "        {\n";
+        o << "            lua_pushstring(state, \"Invalid number of parameters (expected "; 
+        for (iter = paramCounts.begin(), checkCount = 1; iter != paramCounts.end(); iter++)
+        {
+            if (checkCount == paramCounts.size() && paramCounts.size() > 1)
+                o << " or ";
+            o << iter->first;
+            checkCount++;
+
+            if (checkCount < paramCounts.size())
+                o << ", ";
+        }
+        o << ").\");\n";
+        o << "            lua_error(state);\n";
+        o << "            break;\n";
+        o << "        }\n";
+        o << "    }\n";
+        o << "    return 0;\n";
+        o << "}\n\n";
+    }
+}
+
+bool FunctionBinding::signaturesMatch(const FunctionBinding& b1, const FunctionBinding& b2)
+{
+    if (b1.name == b2.name &&
+        b1.type == b2.type)
+    {
+        if (b1.paramTypes.size() != b2.paramTypes.size())
+            return false;
+
+        for (unsigned int i = 0, count = b1.paramTypes.size(); i < count; i++)
+        {
+            if (b1.paramTypes[i] != b2.paramTypes[i])
+                return false;
+        }
+
+        return true;
+    }
+    return false;
+}
+
+ostream& operator<<(ostream& o, const FunctionBinding::Param& param)
+{
+    switch (param.type)
+    {
+    case FunctionBinding::Param::TYPE_VOID:
+        o << "void";
+        break;
+    case FunctionBinding::Param::TYPE_BOOL:
+        o << "bool";
+        break;
+    case FunctionBinding::Param::TYPE_CHAR:
+        o << "char";
+        break;
+    case FunctionBinding::Param::TYPE_SHORT:
+        o << "short";
+        break;
+    case FunctionBinding::Param::TYPE_INT:
+        o << "int";
+        break;
+    case FunctionBinding::Param::TYPE_LONG:
+        o << "long";
+        break;
+    case FunctionBinding::Param::TYPE_UCHAR:
+        o << "unsigned char";
+        break;
+    case FunctionBinding::Param::TYPE_USHORT:
+        o << "unsigned short";
+        break;
+    case FunctionBinding::Param::TYPE_UINT:
+        o << "unsigned int";
+        break;
+    case FunctionBinding::Param::TYPE_ULONG:
+        o << "unsigned long";
+        break;
+    case FunctionBinding::Param::TYPE_FLOAT:
+        o << "float";
+        break;
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        o << "double";
+        break;
+    case FunctionBinding::Param::TYPE_ENUM:
+        o << Generator::getInstance()->getIdentifier(param.info);
+        break;
+    case FunctionBinding::Param::TYPE_STRING:
+        if (param.info == "string")
+            o << "std::string";
+        else
+            o << "const char";
+        break;
+    case FunctionBinding::Param::TYPE_OBJECT:
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+        o << Generator::getInstance()->getIdentifier(param.info);
+        break;
+    case FunctionBinding::Param::TYPE_UNRECOGNIZED:
+        o << param.info;
+        break;
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    default:
+        break;
+    }
+
+    if (param.kind == FunctionBinding::Param::KIND_POINTER)
+        o << "*";
+
+    return o;
+}
+
+// ---------------------------------------------
+// Helper functions
+
+static inline string getLuaTypeString(const FunctionBinding::Param& p)
+{
+    switch (p.type)
+    {
+    case FunctionBinding::Param::TYPE_BOOL:
+        return ((p.kind == FunctionBinding::Param::KIND_POINTER) ? "LUA_TTABLE" : "LUA_TBOOLEAN");
+    case FunctionBinding::Param::TYPE_CHAR:
+    case FunctionBinding::Param::TYPE_SHORT:
+    case FunctionBinding::Param::TYPE_INT:
+    case FunctionBinding::Param::TYPE_LONG:
+    case FunctionBinding::Param::TYPE_UCHAR:
+    case FunctionBinding::Param::TYPE_USHORT:
+    case FunctionBinding::Param::TYPE_UINT:
+    case FunctionBinding::Param::TYPE_ULONG:
+    case FunctionBinding::Param::TYPE_FLOAT:
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        return ((p.kind == FunctionBinding::Param::KIND_POINTER) ? "LUA_TTABLE" : "LUA_TNUMBER");
+    case FunctionBinding::Param::TYPE_STRING:
+    case FunctionBinding::Param::TYPE_ENUM:
+        return "LUA_TSTRING";
+    case FunctionBinding::Param::TYPE_OBJECT:
+        return "LUA_TUSERDATA";
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    case FunctionBinding::Param::TYPE_VOID:
+    case FunctionBinding::Param::TYPE_VARARGS:
+    default:
+        return "LUA_TNONE";
+    }
+}
+
+static inline void indent(ostream& o, int indentLevel)
+{
+    for (int k = 0; k < indentLevel; k++)
+        o << "    ";
+}
+
+static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel)
+{
+    bool isNormalMember = (b.type == FunctionBinding::MEMBER_FUNCTION && b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR);
+
+    // Get the passed in parameters.
+    for (unsigned int i = 0, count = paramCount - (isNormalMember ? 1 : 0); i < count; i++)
+    {
+        outputGetParam(o, b.paramTypes[i], i, indentLevel, isNormalMember);
+    }
+
+    // Get the instance for member functions.
+    if ((b.type == FunctionBinding::MEMBER_FUNCTION) &&
+        b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR &&
+        b.returnParam.type != FunctionBinding::Param::TYPE_DESTRUCTOR)
+    {
+        indent(o, indentLevel);
+        o << b.classname << "* instance = getInstance(state);\n";
+    }
+
+    if (b.returnParam.type == FunctionBinding::Param::TYPE_DESTRUCTOR)
+    {
+        indent(o, indentLevel);
+        o << "void* userdata = luaL_checkudata(state, 1, \"" << Generator::getUniqueName(b.classname) << "\");\n";
+        indent(o, indentLevel);
+        o << "luaL_argcheck(state, userdata != NULL, 1, \"\'" << Generator::getUniqueName(b.classname) << "\' expected.\");\n";
+        indent(o, indentLevel);
+        o << LUA_OBJECT << "* object = (" << LUA_OBJECT << "*)userdata;\n";
+        indent(o, indentLevel);
+        o << "if (object->owns)\n";
+        indent(o, indentLevel);
+        o << "{\n";
+        indent(o, indentLevel + 1);
+        o << b.classname << "* instance = (" << b.classname << "*)object->instance;\n";
+        if (Generator::getInstance()->isRef(b.classname))
+        {
+            indent(o, indentLevel + 1);
+            o << "SAFE_RELEASE(instance);\n";
+        }
+        else
+        {
+            indent(o, indentLevel + 1);
+            o << "SAFE_DELETE(instance);\n";
+        }
+        indent(o, indentLevel);
+        o << "}\n";
+    }
+    else
+    {
+        // Create a variable to hold the return type (if appropriate).
+        if (!(b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR || 
+            b.returnParam.type == FunctionBinding::Param::TYPE_VOID || 
+            b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT))
+        {
+            indent(o, indentLevel);
+            o << b.returnParam << " result = ";
+        }
+
+        // For functions that return objects, create the appropriate user data in Lua.
+        if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR || b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT)
+        {
+            indent(o, indentLevel);
+            o << LUA_OBJECT << "* object = (" << LUA_OBJECT << "*)lua_newuserdata(state, sizeof(" << LUA_OBJECT << "));\n";
+            indent(o, indentLevel);
+            switch (b.returnParam.kind)
+            {
+            case FunctionBinding::Param::KIND_POINTER:
+                o << "object->instance = (void*)";
+                break;
+            case FunctionBinding::Param::KIND_VALUE:
+                o << "object->instance = (void*)new " << b.returnParam << "(";
+                break;
+            case FunctionBinding::Param::KIND_REFERENCE:
+                o << "object->instance = (void*)&(";
+                break;
+            default:
+                GP_ERROR("Invalid return value kind '%d'.", b.returnParam.kind);
+                break;
+            }
+        }
+
+        if (b.type == FunctionBinding::STATIC_FUNCTION)
+        {
+            if (b.returnParam.type == FunctionBinding::Param::TYPE_VOID)
+                indent(o, indentLevel);
+            o << b.classname << "::" << b.name << "(";
+        }
+        else if (b.type == FunctionBinding::GLOBAL_FUNCTION)
+        {
+            if (b.returnParam.type == FunctionBinding::Param::TYPE_VOID)
+                indent(o, indentLevel);
+            o << b.name << "(";
+        }
+        else if (b.type == FunctionBinding::MEMBER_FUNCTION)
+        {
+            if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+            {
+                o << "new " << Generator::getInstance()->getIdentifier(b.returnParam.info) << "(";
+            }
+            else
+            {
+                if (b.returnParam.type == FunctionBinding::Param::TYPE_VOID)
+                    indent(o, indentLevel);
+                o << "instance->" << b.name << "(";
+            }
+        }
+
+        // Pass the arguments.
+        for (unsigned int i = 0, count = paramCount - ((isNormalMember) ? 1 : 0); i < count; i++)
+        {
+            if (b.paramTypes[i].type == FunctionBinding::Param::TYPE_OBJECT && b.paramTypes[i].kind != FunctionBinding::Param::KIND_POINTER)
+                o << "*";
+            o << "param" << i + 1;
+
+            if (i != count - 1)
+                o << ", ";
+        }
+
+        // Output the matching parenthesis for the case where a non-pointer object is being returned.
+        if (b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT && b.returnParam.kind != FunctionBinding::Param::KIND_POINTER)
+            o << ")";
+
+        o << ");\n";
+    }
+
+    outputReturnValue(o, b, indentLevel);
+}
+
+static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, int i, int indentLevel, bool offsetIndex)
+{
+    indent(o, indentLevel);
+    o << "// Get parameter " << i + 1 << " off the stack.\n";
+
+    switch (p.type)
+    {
+    case FunctionBinding::Param::TYPE_UNRECOGNIZED:
+        indent(o, indentLevel);
+        o << "GP_WARN(\"Attempting to get parameter " << i + 1 << " with unrecognized type " << p.info << " as an unsigned integer.\");\n";
+    case FunctionBinding::Param::TYPE_BOOL:
+    case FunctionBinding::Param::TYPE_CHAR:
+    case FunctionBinding::Param::TYPE_SHORT:
+    case FunctionBinding::Param::TYPE_INT:
+    case FunctionBinding::Param::TYPE_LONG:
+    case FunctionBinding::Param::TYPE_UCHAR:
+    case FunctionBinding::Param::TYPE_USHORT:
+    case FunctionBinding::Param::TYPE_UINT:
+    case FunctionBinding::Param::TYPE_ULONG:
+    case FunctionBinding::Param::TYPE_FLOAT:
+    case FunctionBinding::Param::TYPE_DOUBLE:
+    case FunctionBinding::Param::TYPE_STRING:
+    case FunctionBinding::Param::TYPE_ENUM:
+        indent(o, indentLevel);
+        o << p << " param" << i + 1 << " = ";
+        break;
+    default:
+        // Ignore these cases.
+        break;
+    }
+
+    int paramIndex = (offsetIndex) ? i + 2 : i + 1;
+    switch (p.type)
+    {
+    case FunctionBinding::Param::TYPE_BOOL:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptController::getInstance()->getBoolPointer(" << paramIndex << ");\n";
+        else
+            o << "(luaL_checkint(state, " << paramIndex << ") != 0);\n";
+        break;
+    case FunctionBinding::Param::TYPE_CHAR:
+        o << "(char)luaL_checkint(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_SHORT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptController::getInstance()->getShortPointer(" << paramIndex << ");\n";
+        else
+            o << "(short)luaL_checkint(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_INT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptController::getInstance()->getIntPointer(" << paramIndex << ");\n";
+        else
+            o << "(int)luaL_checkint(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_LONG:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptController::getInstance()->getLongPointer(" << paramIndex << ");\n";
+        else
+            o << "(long)luaL_checklong(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_UCHAR:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptController::getInstance()->getUnsignedCharPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned char)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_USHORT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptController::getInstance()->getUnsignedShortPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned short)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_UINT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptController::getInstance()->getUnsignedIntPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned int)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_ULONG:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptController::getInstance()->getUnsignedLongPointer(" << paramIndex << ");\n";
+        else
+            o << "(unsigned long)luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_FLOAT:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptController::getInstance()->getFloatPointer(" << paramIndex << ");\n";
+        else
+            o << "(float)luaL_checknumber(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        if (p.kind == FunctionBinding::Param::KIND_POINTER)
+            o << "ScriptController::getInstance()->getDoublePointer(" << paramIndex << ");\n";
+        else
+            o << "(double)luaL_checknumber(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_STRING:
+        o << "luaL_checkstring(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_ENUM:
+        o << "(" << p << ")lua_enumFromString_" << Generator::getInstance()->getUniqueNameFromRef(p.info) << "(luaL_checkstring(state, " << paramIndex << "));\n";
+        break;
+    case FunctionBinding::Param::TYPE_UNRECOGNIZED:
+        // Attempt to retrieve the unrecognized type as an unsigned integer.
+        o << "(" << p.info << ")luaL_checkunsigned(state, " << paramIndex << ");\n";
+        break;
+    case FunctionBinding::Param::TYPE_OBJECT:
+        indent(o, indentLevel);
+        o << "void* userdata" << paramIndex << " = ScriptController::getInstance()->getObjectPointer(" << paramIndex;
+        o << ", \"" << Generator::getInstance()->getUniqueNameFromRef(p.info) << "\");\n";
+        indent(o, indentLevel);
+        o << "if (!userdata" << paramIndex << ")\n";
+        indent(o, indentLevel);
+        o << "{\n";
+        indent(o, indentLevel + 1);
+        o << "lua_pushstring(state, \"Failed to retrieve a valid object pointer of type \'";
+        o << Generator::getInstance()->getIdentifier(p.info) << "\' for parameter " << paramIndex << ".\");\n";
+        indent(o, indentLevel + 1);
+        o << "lua_error(state);\n";
+        indent(o, indentLevel);
+        o << "}\n";
+        indent(o, indentLevel);
+        o << p;
+        if (p.kind != FunctionBinding::Param::KIND_POINTER)
+            o << "*";
+        o << " param" << i + 1 << " = (" << p;
+        if (p.kind != FunctionBinding::Param::KIND_POINTER)
+            o << "*";
+        o << ")((" << LUA_OBJECT  << "*)userdata" << paramIndex << ")->instance;\n";
+        break;
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    case FunctionBinding::Param::TYPE_VOID:
+    default:
+        // Ignore these cases.
+        break;
+    }
+
+    o << "\n";
+}
+
+static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel)
+{
+    bool isNormalMember = (b.type == FunctionBinding::MEMBER_FUNCTION && b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR);
+
+    // If the current invocation of the function takes zero parameters, then invoke the binding.
+    if (paramCount == 0)
+    {
+        outputBindingInvocation(o, b, paramCount, indentLevel);
+    }
+    else
+    {
+        // NOTE: The way this currently works may cause some issues since Lua
+        // has a smaller set of types than C++. There may be cases where functions
+        // that take types with less precision (i.e. int vs. float) are called
+        // when the user in fact wanted to call the version with more precision.
+        // (this will only happen for overloaded functions).
+
+        o << "if (";
+        for (unsigned int i = 0, count = paramCount; i < count; i++)
+        {
+            string typeStr = "";
+            if (isNormalMember && i == 0)
+                typeStr = getLuaTypeString();
+            else
+                typeStr = getLuaTypeString(b.paramTypes[(isNormalMember ? i - 1 : i)]);
+            
+            // If the type is a basic-type pointer, then allow tables or light-userdata from Lua.
+            if (typeStr == "LUA_TTABLE")
+                o << "(lua_type(state, " << i + 1 << ") == LUA_TTABLE || lua_type(state, " << i + 1 << ") == LUA_TLIGHTUSERDATA)";
+            else
+                o << "lua_type(state, " << i + 1 << ") == " << typeStr;
+
+            if (i == count - 1)
+                o << ")\n";
+            else
+            {
+                o << " &&\n";
+                indent(o, indentLevel + 1);
+            }
+        }
+        indent(o, indentLevel);
+        o << "{\n";
+            
+        outputBindingInvocation(o, b, paramCount, indentLevel + 1);
+
+        indent(o, indentLevel);
+        o << "}\n";
+    }
+}
+
+static inline void outputReturnValue(ostream& o, const FunctionBinding& b, int indentLevel)
+{
+    // Pass the return value back to Lua.
+    if (!(b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR || 
+        b.returnParam.type == FunctionBinding::Param::TYPE_DESTRUCTOR ||
+        b.returnParam.type == FunctionBinding::Param::TYPE_VOID || 
+        b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT))
+    {
+        o << "\n";
+        indent(o, indentLevel);
+        o << "// Push the return value onto the stack.\n";
+
+        // If the return type is a basic type pointer, return it as light user data.
+        if (b.returnParam.type != FunctionBinding::Param::TYPE_ENUM &&
+            b.returnParam.type != FunctionBinding::Param::TYPE_STRING &&
+            b.returnParam.kind == FunctionBinding::Param::KIND_POINTER)
+        {
+            indent(o, indentLevel);
+            o << "lua_pushlightuserdata(state, result);\n";
+            indent(o, indentLevel);
+            o << "return 1;\n";
+            return;
+        }
+    }
+
+    indent(o, indentLevel);
+    switch (b.returnParam.type)
+    {
+    case FunctionBinding::Param::TYPE_BOOL:
+        o << "lua_pushboolean(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_CHAR:
+    case FunctionBinding::Param::TYPE_SHORT:
+    case FunctionBinding::Param::TYPE_INT:
+    case FunctionBinding::Param::TYPE_LONG:
+        o << "lua_pushinteger(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_UCHAR:
+    case FunctionBinding::Param::TYPE_USHORT:
+    case FunctionBinding::Param::TYPE_UINT:
+    case FunctionBinding::Param::TYPE_ULONG:
+        o << "lua_pushunsigned(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_FLOAT:
+    case FunctionBinding::Param::TYPE_DOUBLE:
+        o << "lua_pushnumber(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_ENUM:
+        o << "lua_pushstring(state, lua_stringFromEnum_" << Generator::getInstance()->getUniqueNameFromRef(b.returnParam.info) << "(result).c_str());\n";
+        break;
+    case FunctionBinding::Param::TYPE_STRING:
+        if (b.returnParam.info == "string")
+            o << "lua_pushstring(state, result.c_str());\n";
+        else
+            o << "lua_pushstring(state, result);\n";
+        break;
+    case FunctionBinding::Param::TYPE_OBJECT:
+    case FunctionBinding::Param::TYPE_CONSTRUCTOR:
+        o << "object->owns = ";
+        if (b.own || (b.returnParam.type == FunctionBinding::Param::TYPE_OBJECT && b.returnParam.kind == FunctionBinding::Param::KIND_VALUE))
+            o << "true";
+        else
+            o << "false";
+        o << ";\n";
+        indent(o, indentLevel);
+        o << "luaL_getmetatable(state, \"" << Generator::getInstance()->getUniqueNameFromRef(b.returnParam.info) << "\");\n";
+        indent(o, indentLevel);
+        o << "lua_setmetatable(state, -2);\n";
+        break;
+    case FunctionBinding::Param::TYPE_DESTRUCTOR:
+    case FunctionBinding::Param::TYPE_VOID:
+        o << "\n";
+        indent(o, indentLevel);
+        o << "return 0;\n";
+        return;
+    }
+
+    o << "\n";
+    indent(o, indentLevel);
+    o << "return 1;\n";
+}

+ 165 - 0
gameplay-luagen/src/FunctionBinding.h

@@ -0,0 +1,165 @@
+#ifndef FUNCTIONBINDING_H_
+#define FUNCTIONBINDING_H_
+
+#include "Base.h"
+
+/**
+ * Represents a binding from a function or variable to a function within the script runtime.
+ */
+struct FunctionBinding
+{
+    /**
+     * Represents the type of the binding.
+     */
+    enum Type
+    {
+        GLOBAL_FUNCTION,
+        GLOBAL_VARIABLE,
+        GLOBAL_CONSTANT,
+        STATIC_FUNCTION,
+        STATIC_VARIABLE,
+        STATIC_CONSTANT,
+        MEMBER_FUNCTION,
+        MEMBER_VARIABLE,
+        MEMBER_CONSTANT
+    };
+
+    /**
+     * Represents either a parameter or a return value.
+     */
+    struct Param
+    {
+        /**
+         * Represents the type of parameter or return value.
+         */
+        enum Type
+        {
+            TYPE_CONSTRUCTOR,
+            TYPE_DESTRUCTOR,
+            TYPE_VOID,
+            TYPE_BOOL,
+            TYPE_CHAR,
+            TYPE_SHORT,
+            TYPE_INT,
+            TYPE_LONG,
+            TYPE_UCHAR,
+            TYPE_USHORT,
+            TYPE_UINT,
+            TYPE_ULONG,
+            TYPE_FLOAT,
+            TYPE_DOUBLE,
+            TYPE_STRING,
+            TYPE_OBJECT,
+            TYPE_ENUM,
+            TYPE_UNRECOGNIZED,
+            TYPE_VARARGS
+        };
+
+        /** 
+         * Represents the kind or nature of the parameter/return value.
+         */
+        enum Kind
+        {
+            KIND_VALUE,
+            KIND_REFERENCE,
+            KIND_POINTER
+        };
+
+        /**
+         * Constructor.
+         * 
+         * @param type The type of the parameter.
+         * @param kind The kind of the parameter.
+         * @param info The extra info of the parameter (optional).
+         */
+        Param(Type type = TYPE_VOID, Kind kind = KIND_VALUE, const string& info = "");
+
+        /**
+         * Equality operator.
+         * 
+         * @param p The param to compare to.
+         * @return True if the parameters are equal; false otherwise.
+         */
+        bool operator==(const Param& p) const;
+
+        /**
+         * Inequality operator.
+         * 
+         * @param p The param to compare to.
+         * @return True if the parameters are not equal; false otherwise.
+         */
+        bool operator!=(const Param& p) const;
+
+        /** The type of the parameter. */
+        Type type;
+        /** The kind of the parameter. */
+        Kind kind;
+        /** Extra info (either the class name for a pointer 
+        type or whether a string type is a std::string or a C-string). */
+        string info;
+        /** Whether the parameter has a default value. */
+        bool hasDefaultValue;
+    };
+
+    /**
+     * Constructor.
+     *
+     * @param classname The name of the class that owns this binding.
+     * @param uniquename The class's unique name (used only in the script bindings).
+     */
+    FunctionBinding(string classname = "", string uniquename = "");
+
+    /**
+     * Retrieves the C++ function name for the script binding.
+     * 
+     * @return The C++ function name for the script binding.
+     */
+    string getFunctionName() const;
+
+    /**
+     * Gets the minimum number of parameters needed to call 
+     * the function that the binding corresponds to.
+     * 
+     * @return The minimum number of parameters.
+     */
+    unsigned int getMinParamCount() const;
+
+    /**
+     * Writes out the script binding for the given set of binding objects
+     * (the given set corresponds to all overloaded versions of a function).
+     * 
+     * @param o The output stream to write to.
+     * @param bindings The set of binding objects.
+     */
+    static void write(ostream& o, const vector<FunctionBinding>& bindings);
+
+    /**
+     * Retrieves whether the given two bindings have matching signatures.
+     * 
+     * @param b1 The first binding.
+     * @param b2 The second binding.
+     * @return True if the signatures match; false otherwise.
+     */
+    static bool signaturesMatch(const FunctionBinding& b1, const FunctionBinding& b2);
+
+    /** The binding's type. */
+    Type type;
+    /** The binding's return value. */
+    Param returnParam;
+    /** The binding's parameters. */
+    vector<Param> paramTypes;
+    /** The name of the class that owns this binding. */
+    string classname;
+    /** Holds the class's unique name (used only in the script bindings). */
+    string uniquename;
+    /** The name of the binding (function or variable name). */
+    string name;
+    /** Holds the unique name of the C++ function that implements the Lua binding. */
+    mutable string functionName;
+    /** Holds whether the binding's return value is a object that is owned by whomever calls the function. */
+    bool own;
+};
+
+ostream& operator<<(ostream& o, const FunctionBinding::Param& param);
+
+#endif

+ 1626 - 0
gameplay-luagen/src/Generator.cpp

@@ -0,0 +1,1626 @@
+#include "Generator.h"
+
+Generator* Generator::__instance = NULL;
+
+set<string> __unrecognizedTypes;
+
+// Warning flags.
+static bool __printTemplateWarning = false;
+static bool __printVarargWarning = false;
+static bool __printOperatorWarning = false;
+
+// Utility functions (local to this file).
+static string trim(const string& str);
+static string stripTypeQualifiers(const string& typeStr, FunctionBinding::Param::Kind& kind);
+static inline bool isWantedFileNormal(const string& s);
+static inline bool isNamespaceFile(const string& s);
+static bool getFileList(string directory, vector<string>& files, bool (*isWantedFile)(const string& s));
+
+Generator* Generator::getInstance()
+{
+    if (!__instance)
+        __instance = new Generator();
+
+    return __instance;
+}
+
+void Generator::releaseInstance()
+{
+    SAFE_DELETE(__instance);
+}
+
+string Generator::getUniqueName(string name)
+{
+    // Calculate the unique name for the given identifier (class, struct, enum, etc).
+    string uniquename = name;
+    size_t i = uniquename.find("::");
+    while (i != uniquename.npos)
+    {
+        uniquename.replace(i, 2, SCOPE_REPLACEMENT);
+        i = uniquename.find("::");
+    }
+
+    return uniquename;
+}
+
+string Generator::getUniqueNameFromRef(string refId)
+{
+    return getUniqueName(getIdentifier(refId));
+}
+
+vector<string> Generator::getScopePath(string classname, string ns)
+{
+    size_t i = classname.find("::");
+    int index = 0;
+    vector<string> scopePath;
+    while (i != classname.npos)
+    {
+        string scope = classname.substr(0, i);
+        if (scope != ns)
+            scopePath.push_back(scope);
+        classname = classname.substr(i + 2);
+        i = classname.find("::");
+    }
+
+    return scopePath;
+}
+
+string Generator::getIdentifier(string refId)
+{
+    if (_refIds.find(refId) != _refIds.end())
+        return _refIds[refId];
+    return refId;
+}
+
+string Generator::getClassNameWithoutNamespace(string classname)
+{
+    size_t index = classname.find("::");
+    if (index != classname.npos)
+    {
+        string ns = classname.substr(0, index);
+        if (_namespaces.find(ns) != _namespaces.end())
+        {
+            string tmp = classname.substr(index + 2);
+            size_t tmpIndex = tmp.find("::");
+            if (tmpIndex != tmp.npos)
+                tmp = tmp.substr(0, tmpIndex);
+
+            tmp = ns + string("::") + tmp;
+            if (find(_namespaces[ns].begin(), _namespaces[ns].end(), tmp) != _namespaces[ns].end())
+                return classname.substr(index + 2);
+        }
+    }
+
+    return classname;
+}
+
+void Generator::setIdentifier(string refId, string id)
+{
+    _refIds[refId] = id;
+}
+
+bool Generator::isDerived(const ClassBinding& c, string classname)
+{
+    for (unsigned int i = 0; i < c.derived.size(); i++)
+    {
+        const string& derivedClassName = getIdentifier(c.derived[i]);
+        if (derivedClassName == classname || 
+            (_classes.find(derivedClassName) != _classes.end() &&
+            isDerived(_classes[derivedClassName], classname)))
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
+bool Generator::isRef(string classname)
+{
+    // Check if the class is derived from Ref.
+    for (unsigned int i = 0; i < _topLevelBaseClasses.size(); i++)
+    {
+        if (_topLevelBaseClasses[i] == REF_CLASS_NAME)
+        {
+            return isDerived(_classes[_topLevelBaseClasses[i]], classname);
+        }
+    }
+    return classname == REF_CLASS_NAME;
+}
+
+string Generator::getCompoundName(XMLElement* node)
+{
+    // Get the name of the namespace, class, struct, or file that we are processing.
+    XMLElement* nameElement = node->FirstChildElement("compoundname");
+    if (!nameElement)
+    {
+        GP_ERROR("Missing 'compoundname' child node of 'compounddef' node for XML document '%s'.", _file);
+        return "";
+    }
+    const char* text = nameElement->GetText();
+    if (!text)
+    {
+        GP_ERROR("The 'compoundname' node is empty for XML document '%s'.", _file);
+        return "";
+    }
+
+    return string(text);
+}
+
+void Generator::run(string inDir, string outDir)
+{
+    // Set the output directory.
+    _outDir = outDir;
+
+    // Get a list of the Doxygen XML files that specify a namespace.
+    // Note: we must do this before adding the normal files so that
+    // we we process the files sequentially, we process the namespaces
+    // before the normal files (so that namespaces can be removed
+    // properly from class/struct names, etc.)
+    vector<string> files;
+    getFileList(inDir, files, isNamespaceFile);
+
+    // Add all of the normal Doxygen XML files we want to use to generate Lua bindings.
+    if (!getFileList(inDir, files, isWantedFileNormal) || files.empty())
+    {
+        GP_ERROR("Failed to get a valid list of files to generate bindings from using directory '%s'.", inDir.c_str());
+        return;
+    }
+
+    // Go through each file and build the data needed to generate the bindings.
+    for (vector<string>::iterator iter = files.begin(); iter != files.end(); iter++)
+    {
+        tinyxml2::XMLDocument doc;
+        _file = iter->c_str();
+        doc.LoadFile(iter->c_str());
+
+        int ret = doc.ErrorID();
+        if (ret != 0)
+        {
+            GP_ERROR("Failed to load XML document '%s' properly with error ID %d.", iter->c_str(), ret);
+            continue;
+        }
+
+        XMLElement* rootNode = doc.FirstChildElement("doxygen");
+        if (!rootNode)
+        {
+            GP_ERROR("Missing root 'doxygen' node for XML document '%s'.", iter->c_str());
+            continue;
+        }
+        XMLElement* node = rootNode->FirstChildElement("compounddef");
+        if (!node)
+        {
+            GP_ERROR("Missing 'compounddef' node for XML document '%s'.", iter->c_str());
+            continue;
+        }
+
+        const char* kind = node->Attribute("kind");
+        if (kind && strcmp(kind, "namespace") == 0)
+        {
+            string name = getCompoundName(node);
+            cout << "Parsing namespace " << name << "...\n";
+            getNamespace(node, name);
+        }
+        else if ((kind && strcmp(kind, "class") == 0 || strcmp(kind, "struct") == 0) &&
+            strcmp(node->Attribute("prot"), "public") == 0)
+        {
+            string name = getCompoundName(node);
+            cout << "Parsing class/struct " << name << "...\n";
+            getClass(node, name);
+        }
+        else if (kind && strcmp(kind, "file") == 0)
+        {
+            string name = getCompoundName(node);
+            cout << "Parsing file " << name << "...\n";
+            getFunctions(node);
+            getEnums(node);
+        }
+    }
+
+    // Resolve all inheritance.
+    resolveInheritance();
+
+    // Resolve all unrecognized parameter and return value types.
+    resolveTypes();
+
+    // Generate the script bindings.
+    generateBindings();
+
+    // Print out all unrecognized parameter types.
+    if (__unrecognizedTypes.size() > 0)
+    {
+        cout << "\nUnrecognized Types:\n";
+        for (set<string>::iterator iter = __unrecognizedTypes.begin(); iter!= __unrecognizedTypes.end(); iter++)
+        {
+            cout << *iter << "\n";
+        }
+    }
+
+    // Print warnings for the use of unsupported C++ features.
+    if (__printTemplateWarning)
+        GP_WARN("Detected the use of template parameters; this feature of C++ is not supported.");
+    if (__printVarargWarning)
+        GP_WARN("Detected the use of variable argument lists; this feature of C++ is not supported.");
+    if (__printOperatorWarning)
+        GP_WARN("Detected the use of operator overloading; this feature of C++ is not supported.");
+}
+
+Generator::Generator()
+{
+}
+
+Generator::~Generator()
+{
+}
+
+void Generator::getFunctions(XMLElement* fileNode)
+{
+    // Add needed include files.
+    XMLElement* include = NULL;
+    for (include = fileNode->FirstChildElement("includes"); include != NULL; include = include->NextSiblingElement("includes"))
+    {
+        if (strcmp(include->Attribute("local"), "yes") == 0)
+            _includes.insert(include->GetText());
+    }
+
+    // Process all public, non-static functions and variables that are defined in this file.
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    const char* isStatic = NULL;
+    for (node = fileNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (kind && strcmp(kind, "func") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                isStatic = e->Attribute("static");
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore" &&
+                    (!isStatic || strcmp(isStatic, "yes") != 0))
+                {
+                    FunctionBinding b;
+                    b.type = FunctionBinding::GLOBAL_FUNCTION;
+                    b.name = getName(e);
+                
+                    // Ignore operators.
+                    if (b.name.find("operator") != 0)
+                    {
+                        b.returnParam = getParam(e);
+
+                        getParams(e, b);
+                        getCreateFlag(e, b);
+                        _functions[b.getFunctionName()].push_back(b);
+                    }
+                    else
+                    {
+                        __printOperatorWarning = true;
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else if (kind && strcmp(kind, "var") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                isStatic = e->Attribute("static");
+                if (getScriptFlag(e) != "ignore" &&
+                    (!isStatic || strcmp(isStatic, "yes") != 0))
+                {
+                    FunctionBinding b;
+                    if (getIsConstType(e))
+                        b.type = FunctionBinding::GLOBAL_CONSTANT;
+                    else
+                        b.type = FunctionBinding::GLOBAL_VARIABLE;
+
+                    b.name = getName(e);
+                    b.returnParam = getParam(e, true);
+                    _functions[b.getFunctionName()].push_back(b);
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+    }
+}
+
+void Generator::getNamespace(XMLElement* nsNode, const string& name)
+{
+    // Skip the 'std' namespace.
+    if (name == "std")
+        return;
+
+    // Create a list of all classes that are a part of this namespace.
+    XMLElement* e = nsNode->FirstChildElement("innerclass");
+    while (e)
+    {
+        _namespaces[name].push_back(e->GetText());
+        e = e->NextSiblingElement("innerclass");
+    }
+
+    // Parse all functions that are directly in this namespace.
+    getFunctions(nsNode);
+
+    // Parse all enums that are directly in this namespace.
+    getEnums(nsNode, name);
+
+    // Parse all typedefs.
+    getTypedefs(nsNode, name);
+    e = nsNode->FirstChildElement("");
+}
+
+void Generator::getClass(XMLElement* classNode, const string& name)
+{
+    // Check if we should ignore this class.
+    if (getScriptFlag(classNode) == "ignore")
+        return;
+
+    // Get the ref id for the class.
+    string refId = classNode->Attribute("id");
+
+    // Create the class binding object that we will store the function bindings in (name -> binding).
+    ClassBinding classBinding(name, refId);
+
+    // Store the mapping between the ref id and the class's fully qualified name.
+    Generator::getInstance()->setIdentifier(refId, classBinding.classname);
+
+    // Get the include header for the original class declaration.
+    XMLElement* includeElement = classNode->FirstChildElement("includes");
+    if (includeElement)
+    {
+        const char* text = includeElement->GetText();
+        if (!text)
+        {
+            GP_ERROR("The 'includes' node is empty (a class must have an include file) for XML document '%s'.", _file);
+            return;
+        }
+        classBinding.include = text;
+    }
+    else
+    {
+        // See if we are an inner class. If so, attempt to get the include from the root parent class.
+        size_t index = classBinding.classname.find("::");
+        if (index != classBinding.classname.npos)
+        {
+            string parentClassName = classBinding.classname.substr(0, index);
+            if (_classes.find(parentClassName) != _classes.end())
+                classBinding.include = _classes[parentClassName].include;
+        }
+    }
+
+    // Track whether the class has any pure virtual functions.
+    bool hasPureVirtual = false;
+
+    // Process all public members that are defined in this class.
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    for (node = classNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (!kind)
+        {
+            GP_ERROR("Section definition is missing required 'kind' attribute in XML document  '%s'.", _file);
+            return;
+        }
+
+        // Process public static functions.
+        if (strcmp(kind, "public-static-func") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::STATIC_FUNCTION;
+
+                    b.name = getName(e);
+                    b.returnParam = getParam(e, false, b.classname);
+                        
+                    getParams(e, b);
+                    getCreateFlag(e, b);
+                    classBinding.bindings[b.getFunctionName()].push_back(b);
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public member functions.
+        else if (strcmp(kind, "public-func") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    if (strcmp(e->Attribute("virt"), "pure-virtual") == 0)
+                        hasPureVirtual = true;
+
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::MEMBER_FUNCTION;
+
+                    b.name = getName(e);
+                
+                    // Ignore operators.
+                    if (b.name.find("operator") != 0)
+                    {
+                        b.returnParam = getParam(e, false, b.classname);
+                        if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+                        {
+                            b.returnParam.info = refId;
+                            b.own = true;
+                        }
+
+                        getParams(e, b);
+                        getCreateFlag(e, b);
+                        classBinding.bindings[b.getFunctionName()].push_back(b);
+                    }
+                    else
+                    {
+                        __printOperatorWarning = true;
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public static variables.
+        else if (strcmp(kind, "public-static-attrib") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    if (getIsConstType(e))
+                        b.type = FunctionBinding::STATIC_CONSTANT;
+                    else
+                        b.type = FunctionBinding::STATIC_VARIABLE;
+
+                    b.name = getName(e);
+                    b.returnParam = getParam(e, true, b.classname);
+                    classBinding.bindings[b.getFunctionName()].push_back(b);
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public member variables.
+        else if (strcmp(kind, "public-attrib") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    if (getIsConstType(e))
+                        b.type = FunctionBinding::MEMBER_CONSTANT;
+                    else
+                        b.type = FunctionBinding::MEMBER_VARIABLE;
+
+                    b.name = getName(e);
+                    b.returnParam = getParam(e, true, b.classname);
+                    classBinding.bindings[b.getFunctionName()].push_back(b);
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else if (strcmp(kind, "protected-func") == 0 ||
+                 strcmp(kind, "private-func") == 0)
+        {
+            // Check for inaccessible constructor/destructor
+            // and create a list of all other inaccessible functions
+            // (we do this so that classes that override a public function
+            // and change its scope to protected or private work properly
+            // from Lua-i.e. no binding is generated for such functions).
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (strcmp(e->Attribute("virt"), "pure-virtual") == 0)
+                    hasPureVirtual = true;
+
+                FunctionBinding::Param t = getParam(e);
+                if (t.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+                {
+                    classBinding.inaccessibleConstructor = true;
+                }
+                else if (t.type == FunctionBinding::Param::TYPE_DESTRUCTOR)
+                {
+                    classBinding.inaccessibleDestructor = true;
+                }
+                else
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::MEMBER_FUNCTION;
+
+                    b.name = getName(e);
+                
+                    // Ignore operators.
+                    if (b.name.find("operator") != 0)
+                    {
+                        b.returnParam = getParam(e, false, b.classname);
+                        if (b.returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+                        {
+                            b.returnParam.info = refId;
+                            b.own = true;
+                        }
+
+                        getParams(e, b);
+                        getCreateFlag(e, b);
+                        classBinding.hidden[b.getFunctionName()].push_back(b);
+                    }
+                    else
+                    {
+                        __printOperatorWarning = true;
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else if (strcmp(kind, "protected-static-func") == 0 ||
+                 strcmp(kind, "private-static-func") == 0)
+        {
+            // Create a list of all other inaccessible functions
+            // (we do this so that classes that override a public function
+            // and change its scope to protected or private work properly
+            // from Lua-i.e. no binding is generated for such functions).
+
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (e->FirstChildElement("templateparamlist"))
+                {
+                    __printTemplateWarning = true;
+                }
+                else if (getScriptFlag(e) != "ignore")
+                {
+                    FunctionBinding b(classBinding.classname, classBinding.uniquename);
+                    b.type = FunctionBinding::STATIC_FUNCTION;
+
+                    b.name = getName(e);
+                    b.returnParam = getParam(e, false, b.classname);
+                        
+                    getParams(e, b);
+                    getCreateFlag(e, b);
+                    classBinding.hidden[b.getFunctionName()].push_back(b);
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        // Process public enums and typedefs.
+        else if (strcmp(kind, "public-type") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore")
+                {
+                    if (strcmp(e->Attribute("kind"), "enum") == 0)
+                    {
+                        getEnum(e, classBinding.classname, classBinding.ns, classBinding.include);
+                    }
+                    else if (strcmp(e->Attribute("kind"), "typedef") == 0)
+                    {
+                        getTypedef(e, classBinding.classname, classBinding.ns);
+                    }
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+        else
+        {
+            // Ignore other section definitions.
+        }
+    }
+
+    // If the class has a pure-virtual method, we mark the constructor as inaccessible
+    // and remove any constructor bindings that are in the list.
+    if (hasPureVirtual)
+    {
+        classBinding.inaccessibleConstructor = true;
+        map<string, vector<FunctionBinding> >::iterator iter = classBinding.bindings.begin();
+        for (; iter != classBinding.bindings.end(); iter++)
+        {
+            if (iter->second[0].returnParam.type == FunctionBinding::Param::TYPE_CONSTRUCTOR)
+            {
+                classBinding.bindings.erase(iter);
+                break;
+            }
+        }
+    }
+
+    // Store the class's derived class(es)' ref id(s) if it has any.
+    node = classNode->FirstChildElement("derivedcompoundref");
+    while (node)
+    {
+        classBinding.derived.push_back(node->Attribute("refid"));
+        node = node->NextSiblingElement("derivedcompoundref");
+    }
+
+    // If the class has no base classes and it has derived classes, add it to the list of top-level classes.
+    if (!classNode->FirstChildElement("basecompoundref") && classBinding.derived.size() > 0)
+        _topLevelBaseClasses.push_back(classBinding.classname);
+
+    // Insert the class binding into the global table.
+    _classes[classBinding.classname] = classBinding;
+}
+
+void Generator::getEnums(XMLElement* fileNode, string ns)
+{
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    for (node = fileNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (!kind)
+        {
+            GP_ERROR("Section definition is missing required 'kind' attribute in XML document  '%s'.", _file);
+            return;
+        }
+
+        // Process the enums.
+        if (strcmp(kind, "enum") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore" && strcmp(e->Attribute("kind"), "enum") == 0)
+                {
+                    getEnum(e, "", ns);
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+    }
+}
+
+void Generator::getEnum(XMLElement* e, string classname, string ns, string include)
+{
+    // Get the enumeration's name.
+    string enumname = classname;
+    if (enumname.size() > 0)
+        enumname += string("::");
+    enumname += getName(e);
+
+    // Get the ref id for the enum.
+    string refId = e->Attribute("id");
+
+    // Store the ref id to name mapping.
+    Generator::getInstance()->setIdentifier(refId, enumname);
+
+    e = e->FirstChildElement("enumvalue");
+    while (e)
+    {
+        if (_enums.find(enumname) == _enums.end())
+            _enums[enumname].scopePath = Generator::getScopePath(enumname, ns);
+
+        _enums[enumname].values.push_back(getName(e));
+
+        // Add the include file to the list of includes for the global bindings file.
+        if (include.size() > 0)
+            _includes.insert(include);
+
+        e = e->NextSiblingElement("enumvalue");
+    }
+}
+
+void Generator::getTypedefs(XMLElement* fileNode, string ns)
+{
+    XMLElement* node = NULL;
+    const char* kind = NULL;
+    for (node = fileNode->FirstChildElement("sectiondef"); node != NULL; node = node->NextSiblingElement("sectiondef"))
+    {
+        kind = node->Attribute("kind");
+        if (!kind)
+        {
+            GP_ERROR("Section definition is missing required 'kind' attribute in XML document  '%s'.", _file);
+            return;
+        }
+
+        // Process the enums.
+        if (strcmp(kind, "typedef") == 0)
+        {
+            XMLElement* e = node->FirstChildElement("memberdef");
+            while (e)
+            {
+                if (getScriptFlag(e) != "ignore" && strcmp(e->Attribute("kind"), "typedef") == 0)
+                {
+                    getTypedef(e, "", ns);
+                }
+                e = e->NextSiblingElement("memberdef");
+            }
+        }
+    }
+}
+
+void Generator::getTypedef(XMLElement* e, string classname, string ns)
+{
+    TypedefBinding t;
+
+    // Get the typedef's name.
+    string tname = classname;
+    if (tname.size() > 0)
+        tname += string("::");
+    tname += getName(e);
+
+    if (!REMOVE_NAMESPACE)
+        tname = ns + string("::") + tname;
+
+    // Get the typedef's id and store the mapping from ref id to name.
+    string refId = e->Attribute("id");
+    setIdentifier(refId, tname);
+
+    FunctionBinding::Param p = getParam(e);
+    if (p.info.size() > 0)
+        t.refId = p.info;
+
+    _typedefs[tname] = t;
+}
+
+static inline bool getScriptFlagHelper(XMLElement* e, string& flag)
+{
+    XMLElement* x = e->FirstChildElement("xmlonly");
+    if (x)
+    {
+        flag = x->GetText();
+        return true;
+    }
+
+    x = e->FirstChild() ? e->FirstChild()->ToElement() : NULL;
+    while (x)
+    {
+        if (getScriptFlagHelper(x, flag))
+            return true;
+
+        x = x->NextSibling() ? x->NextSibling()->ToElement() : NULL;
+    }
+    return false;
+}
+
+string Generator::getScriptFlag(XMLElement* e)
+{
+    string flag;
+
+    XMLElement* n = e->FirstChildElement("detaileddescription");
+    if (n)
+        getScriptFlagHelper(n, flag);
+    
+    return flag;
+}
+
+
+void Generator::getCreateFlag(XMLElement* e, FunctionBinding& b)
+{
+    if (getScriptFlag(e) == "create")
+        b.own = true;
+}
+
+string Generator::getName(XMLElement* e)
+{
+    // Get the name for the binding.
+    XMLElement* nameElement = e->FirstChildElement("name");
+    if (!nameElement)
+    {
+        GP_ERROR("Missing 'name' child node in XML document '%s'.", _file);
+        return string();
+    }
+    return nameElement->GetText();
+}
+
+bool Generator::getIsConstType(XMLElement* e)
+{
+    XMLElement* typeElement = e->FirstChildElement("type");
+    if (!typeElement)
+    {
+        GP_ERROR("Missing 'type' node in XML document '%s'.", _file);
+        return false;
+    }
+
+    XMLNode* textNode = typeElement->FirstChild();
+    if (textNode)
+    {
+        XMLText* text = textNode->ToText();
+        if (text)
+        {
+            string type = text->Value();
+            return type.find("const") != type.npos;
+        }
+    }
+    return false;
+}
+
+FunctionBinding::Param Generator::getParam(XMLElement* e, bool isVariable, string classname)
+{
+    // Get the type for the current element (either the return type or a parameter type).
+    XMLElement* typeElement = e->FirstChildElement("type");
+    if (!typeElement)
+    {
+        GP_ERROR("Missing 'type' node in XML document '%s'.", _file);
+    }
+
+    FunctionBinding::Param p;
+    XMLNode* textNode = typeElement->FirstChild();
+    if (!textNode)
+    {
+        // Get the name of the current element to see if it is a destructor.
+        string name = getName(e);
+        if (name.find("~") == 0)
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_DESTRUCTOR);
+        }
+        else
+        {
+            // Assume it's a constructor.
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_CONSTRUCTOR, FunctionBinding::Param::KIND_POINTER, name);
+        }
+    }
+    else
+    {
+
+        // Get the type string without const or reference qualifiers (and trim whitespace).
+        string refId = "";
+        string typeStr = "";
+        FunctionBinding::Param::Kind kind;
+        {
+            // Attempt to process the type as reference (i.e. class, struct, enum, typedef, etc.) type.
+            XMLNode* node = textNode;
+            while (node)
+            {
+                if (strcmp(node->Value(), "ref") == 0)
+                {
+                    refId = node->ToElement()->Attribute("refid");
+                    typeStr += node->ToElement()->GetText();
+                }
+                else if (node->ToText())
+                {
+                    typeStr += node->ToText()->Value();
+                }
+
+                node = node->NextSibling();
+            }
+
+            typeStr = stripTypeQualifiers(typeStr, kind);
+        }
+
+        if (typeStr == "void")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_VOID, kind);
+        }
+        else if (typeStr == "bool")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_BOOL, kind);
+        }
+        else if (typeStr == "char" && kind != FunctionBinding::Param::KIND_POINTER)
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_CHAR, kind);
+        }
+        else if (typeStr == "short")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_SHORT, kind);
+        }
+        else if (typeStr == "int")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_INT, kind);
+        }
+        else if (typeStr == "long")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_LONG, kind);
+        }
+        else if (typeStr == "unsigned char")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_UCHAR, kind);
+        }
+        else if (typeStr == "unsigned short")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_USHORT, kind);
+        }
+        else if (typeStr == "unsigned int")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_UINT, kind);
+        }
+        else if (typeStr == "unsigned long")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_ULONG, kind);
+        }
+        else if (typeStr == "float")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_FLOAT, kind);
+        }
+        else if (typeStr == "double")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_DOUBLE, kind);
+        }
+        else if (typeStr == "string" || typeStr == "std::string")
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_STRING, kind, "string");
+        }
+        else if (typeStr == "char" && kind == FunctionBinding::Param::KIND_POINTER)
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_STRING, kind, "char*");
+        }
+        else if (_enums.find(typeStr) != _enums.end() ||
+            (classname.size() > 0 && _enums.find(classname + string("::") + typeStr) != _enums.end()))
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_ENUM, kind, refId);
+        }
+        else if (typeStr == "...")
+        {
+            __printVarargWarning = true;
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_VARARGS);
+        }
+        else
+        {
+            p = FunctionBinding::Param(FunctionBinding::Param::TYPE_UNRECOGNIZED, kind, (refId.size() > 0) ? refId : typeStr);
+        }
+
+        // Check if the type is a pointer declared with square brackets (i.e. float x[4]).
+        XMLElement* arrayElement = NULL;
+        if ((arrayElement = e->FirstChildElement("array")) != NULL ||
+            (isVariable && (arrayElement = e->FirstChildElement("argsstring")) != NULL))
+        {
+            const char* text = arrayElement->GetText();
+            string arrayString = (text ? text : "");
+            string::size_type i = arrayString.find("[");
+            string::size_type k = arrayString.find("]");
+            if (i != arrayString.npos && k != arrayString.npos)
+            {
+                p.kind = FunctionBinding::Param::KIND_POINTER;
+                if (i != k - 1)
+                    p.info = arrayString.substr(i + 1, k - (i + 1));
+            }
+        }
+    }
+
+    // Get the default value for the parameter if it has one.
+    XMLElement* defaultValueElement = e->FirstChildElement("defval");
+    if (defaultValueElement)
+    {
+        p.hasDefaultValue = true;
+    }
+
+    return p;
+}
+
+void Generator::getParams(XMLElement* e, FunctionBinding& b)
+{
+    XMLElement* param = e->FirstChildElement("param");
+    while (param)
+    {
+        FunctionBinding::Param p = getParam(param, false, b.classname);
+        if (p.type != FunctionBinding::Param::TYPE_VARARGS)
+            b.paramTypes.push_back(p);
+        param = param->NextSiblingElement("param");
+    }
+}
+
+void Generator::resolveMembers(const ClassBinding& c)
+{
+    vector<ClassBinding*> derived;
+
+    // Go through the derived classes' bindings and update them.
+    ClassBinding* cb = NULL;
+    map<string, vector<FunctionBinding> >::const_iterator iter;
+    for (unsigned int i = 0; i < c.derived.size(); i++)
+    {
+        // If the class is not in the map of classes, then
+        // it was marked to be ignored, so skip over it.
+        string derivedClassName = getIdentifier(c.derived[i]);
+        if (_classes.find(derivedClassName) == _classes.end())
+            continue;
+
+        cb = &_classes[derivedClassName];
+
+        // Go through this class' bindings and add them to the current
+        // derived class if they are not already there (excluding constructors and destructors).
+        for (iter = c.bindings.begin(); iter != c.bindings.end(); iter++)
+        {
+            FunctionBinding b(cb->classname, cb->uniquename);
+            b.type = iter->second[0].type;
+            b.name = iter->second[0].name;
+
+            if (b.name == "create" && c.classname == "Node")
+                int x = 42;
+
+            map<string, vector<FunctionBinding> >::iterator findIter = cb->bindings.find(b.getFunctionName());
+            map<string, vector<FunctionBinding> >::iterator hiddenIter = cb->hidden.find(b.getFunctionName());
+            if (findIter == cb->bindings.end() && hiddenIter == cb->hidden.end())
+            {
+                for (unsigned int i = 0, iCount = iter->second.size(); i < iCount; i++)
+                {
+                    if (iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR &&
+                        iter->second[i].returnParam.type != FunctionBinding::Param::TYPE_DESTRUCTOR)
+                    {
+                        // Copy the binding, but set its function name to 
+                        // empty so that it is regenerated correctly.
+                        b = iter->second[i];
+                        b.functionName = "";
+                        b.classname = cb->classname;
+                        b.uniquename = cb->uniquename;
+
+                        cb->bindings[b.getFunctionName()].push_back(b);
+                    }
+                }
+            }
+            else
+            {
+                bool addBinding;
+                for (unsigned int i = 0, iCount = iter->second.size(); i < iCount; i++)
+                {
+                    addBinding = true;
+                    if (findIter != cb->bindings.end())
+                    {
+                        for (unsigned int j = 0, jCount = findIter->second.size(); j < jCount; j++)
+                        {
+                            if (FunctionBinding::signaturesMatch(iter->second[i], findIter->second[j]))
+                            {
+                                addBinding = false;
+                                break;
+                            }
+                        }
+                    }
+                    if (hiddenIter != cb->hidden.end())
+                    {
+                        for (unsigned int j = 0, jCount = hiddenIter->second.size(); j < jCount; j++)
+                        {
+                            if (FunctionBinding::signaturesMatch(iter->second[i], hiddenIter->second[j]))
+                            {
+                                addBinding = false;
+                                break;
+                            }
+                        }
+                    }
+
+                    if (addBinding)
+                    {
+                        FunctionBinding b = iter->second[i];
+                        b.name = iter->second[i].classname + string("::") + iter->second[i].name;
+                        b.classname = cb->classname;
+                        b.uniquename = getUniqueName(cb->classname);
+
+                        if (findIter != cb->bindings.end())
+                            findIter->second.push_back(b);
+                        else
+                            cb->bindings[b.getFunctionName()].push_back(b);
+                    }
+                }
+            }
+        }
+
+        derived.push_back(cb);
+    }
+
+    // Go through the derived classes' bindings and resolve the members for their derived classes.
+    for (unsigned int i = 0; i < derived.size(); i++)
+    {
+        resolveMembers(*derived[i]);
+    }
+}
+
+void Generator::resolveInheritance()
+{
+    // Go through the class inheritance tree and update each class's bindings list 
+    // to include the bindings from the base class that haven't been overridden.
+    for (unsigned int i = 0; i < _topLevelBaseClasses.size(); i++)
+    {
+        resolveMembers(_classes[_topLevelBaseClasses[i]]);
+    }
+}
+
+void Generator::resolveType(FunctionBinding::Param* param, string functionName)
+{
+    if (param->type == FunctionBinding::Param::TYPE_UNRECOGNIZED)
+    {
+        string name = getIdentifier(param->info);
+        map<string, TypedefBinding>::iterator typedefIter = _typedefs.find(name);
+        if (typedefIter != _typedefs.end() && typedefIter->second.refId.size() > 0)
+        {
+            param->type = FunctionBinding::Param::TYPE_OBJECT;
+            param->info = typedefIter->second.refId;
+        }
+        else
+        {
+            map<string, ClassBinding>::iterator classIter = _classes.find(name);
+            if (classIter != _classes.end())
+            {
+                param->type = FunctionBinding::Param::TYPE_OBJECT;
+            }
+            else
+            {
+                map<string, EnumBinding>::iterator enumIter = _enums.find(name);
+                if (enumIter != _enums.end())
+                {
+                    param->type = FunctionBinding::Param::TYPE_ENUM;
+                }
+                else
+                {
+                    __unrecognizedTypes.insert(functionName + string(" -- ") + (name.size() > 0 ? name : param->info));
+                }
+            }
+        }
+    }
+}
+
+void Generator::resolveTypes()
+{
+    // Go through all member functions and attempt to resolve unrecognized types.
+    for (map<string, ClassBinding>::iterator iter = _classes.begin(); iter != _classes.end(); iter++)
+    {
+        map<string, vector<FunctionBinding> >::iterator functionNameIter = iter->second.bindings.begin();
+        for (; functionNameIter != iter->second.bindings.end(); functionNameIter++)
+        {
+            vector<FunctionBinding>::iterator functionIter = functionNameIter->second.begin();
+            for (; functionIter != functionNameIter->second.end(); functionIter++)
+            {
+                resolveType(&functionIter->returnParam, iter->first + string("::") + functionIter->name);
+
+                vector<FunctionBinding::Param>::iterator paramIter = functionIter->paramTypes.begin();
+                for (; paramIter != functionIter->paramTypes.end(); paramIter++)
+                {
+                    resolveType(&(*paramIter), iter->first + string("::") + functionIter->name);
+                }
+            }
+        }
+    }
+
+    // Go through all non-member functions and attempt to resolve unrecognized types.
+    for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+    {
+        vector<FunctionBinding>::iterator functionIter = iter->second.begin();
+        for (; functionIter != iter->second.end(); functionIter++)
+        {
+            resolveType(&functionIter->returnParam, functionIter->name);
+
+            vector<FunctionBinding::Param>::iterator paramIter = functionIter->paramTypes.begin();
+            for (; paramIter != functionIter->paramTypes.end(); paramIter++)
+            {
+                resolveType(&(*paramIter), functionIter->name);
+            }
+        }
+    }
+}
+
+void Generator::generateBindings()
+{
+    string* bindingNS = new string("gameplay");
+
+    ofstream luaAllH(_outDir + string(LUA_ALL_BINDINGS_FILENAME) + string(".h"));
+    string includeGuard = string(LUA_ALL_BINDINGS_FILENAME) + string("_H_");
+    transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper);
+    luaAllH << "#ifndef " << includeGuard << "\n";
+    luaAllH << "#define " << includeGuard << "\n\n";
+    
+    ofstream luaAllCpp(_outDir + string(LUA_ALL_BINDINGS_FILENAME) + string(".cpp"));
+    luaAllCpp << "#include \"Base.h\"\n";
+    luaAllCpp << "#include \"" << string(LUA_ALL_BINDINGS_FILENAME) << ".h\"\n\n";
+    if (bindingNS)
+    {
+        luaAllCpp << "namespace " << *bindingNS << "\n";
+        luaAllCpp << "{\n\n";
+    }
+    luaAllCpp << "void lua_RegisterAllBindings()\n";
+    luaAllCpp << "{\n";
+
+    // Write out all the class bindings.
+    if (_classes.size() > 0)
+    {
+        map<string, ClassBinding>::iterator iter = _classes.begin();
+        for (; iter != _classes.end(); iter++)
+        {
+            cout << "Generating bindings for '" << iter->first << "'...\n";
+            iter->second.write(_outDir, bindingNS);
+
+            luaAllH << "#include \"lua_" << iter->second.uniquename << ".h\"\n";
+            luaAllCpp << "    luaRegister_" << iter->second.uniquename << "();\n";
+        }
+    }
+
+    // Go through all the classes and if they have any derived classes, add them to the list of base classes.
+    vector<string> baseClasses;
+    for (map<string, ClassBinding>::iterator iter = _classes.begin(); iter != _classes.end(); iter++)
+    {
+        if (iter->second.derived.size() > 0)
+            baseClasses.push_back(iter->first);
+    }
+
+    // Write out the global bindings file.
+    cout << "Generating global bindings...\n";
+    if (baseClasses.size() > 0 || _functions.size() > 0 || _enums.size() > 0)
+    {
+        // Write out the header file.
+        {
+            string path = _outDir + string(LUA_GLOBAL_FILENAME) + string(".h");
+            ofstream global(path);
+            if (!global)
+            {
+                GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str());
+                goto end;
+            }
+            includeGuard = string(LUA_GLOBAL_FILENAME) + string("_H_");
+            transform(includeGuard.begin(), includeGuard.end(), includeGuard.begin(), ::toupper);
+            global << "#ifndef " << includeGuard << "\n";
+            global << "#define " << includeGuard << "\n\n";
+
+            // Write out the needed includes.
+            for (set<string>::iterator iter = _includes.begin(); iter != _includes.end(); iter++)
+            {
+                // Don't include inline files.
+                if (iter->find(".inl") == iter->npos)
+                    global << "#include \"" << *iter << "\"\n";
+            }
+            global << "\n";
+            luaAllH << "#include \"" << string(LUA_GLOBAL_FILENAME) << ".h\"\n";
+            luaAllCpp << "    luaRegister_" << LUA_GLOBAL_FILENAME << "();\n";
+
+            if (bindingNS)
+            {
+                global << "namespace " << *bindingNS << "\n";
+                global << "{\n\n";
+            }
+
+            if (_functions.size() > 0)
+            {
+                global << "// Lua bindings for global functions.\n";
+
+                // Write out the binding function declarations.
+                for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+                {
+                    global << "int " << iter->second[0].getFunctionName() << "(lua_State* state);\n";
+                }
+                global << "\n";
+            }
+
+            if (_enums.size() > 0)
+            {
+                global << "// Lua bindings for enum conversion functions.\n";
+
+                // Write out the enum conversion function declarations.
+                for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+                {
+                    global << iter->first << " lua_enumFromString_" << getUniqueName(iter->first) << "(const char* s);\n";
+                    global << "std::string lua_stringFromEnum_" << getUniqueName(iter->first) << "(" << iter->first << " e);\n";
+                }
+                global << "\n";
+            }
+            
+            // Write out the signature of the function used to register the global functions with Lua.
+            global << "void luaRegister_" << LUA_GLOBAL_FILENAME << "();\n\n";
+
+            if (bindingNS)
+                global << "}\n\n";
+            global << "#endif\n";
+            global.close();
+        }
+
+        // Write out the implementation.
+        {
+            string path = _outDir + string(LUA_GLOBAL_FILENAME) + string(".cpp");
+            ofstream global(path);
+            if (!global)
+            {
+                GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str());
+                goto end;
+            }
+            
+            global << "#include \"ScriptController.h\"\n";
+            global << "#include \"" << LUA_GLOBAL_FILENAME << ".h\"\n\n";
+
+            if (bindingNS)
+            {
+                global << "namespace " << *bindingNS << "\n";
+                global << "{\n\n";
+            }
+
+            // Write out the function used to register all global bindings with Lua.
+            global << "void luaRegister_" << LUA_GLOBAL_FILENAME << "()\n";
+            global << "{\n";
+            global << "    ScriptController* sc = ScriptController::getInstance();\n";
+        
+            if (_functions.size() > 0)
+            {
+                global << "\n";
+                // Bind the non-member functions.
+                for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+                {
+                    global << "    sc->registerFunction(\"" << iter->second[0].name << "\", " << iter->second[0].getFunctionName() << ");\n";
+                }
+            }
+
+            // Generate the hierarchy map.
+            if (baseClasses.size() > 0)
+            {
+                global << "\n    std::map<std::string, std::vector<std::string> > hierarchy;\n";
+                for (unsigned int i = 0, count = baseClasses.size(); i < count; i++)
+                {
+                    set<string> derived;
+                    getAllDerived(derived, baseClasses[i]);
+                    for (set<string>::iterator iter = derived.begin(); iter != derived.end(); iter++)
+                    {
+                        global << "    hierarchy[\"" << baseClasses[i] << "\"].push_back(\"" << *iter << "\");\n";
+                    }
+                }
+                global << "    sc->setGlobalHierarchy(hierarchy);\n";
+            }
+
+            // Register all enums.
+            if (_enums.size() > 0)
+            {
+                for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+                {
+                    global << "\n    // Register enumeration " << iter->first << ".\n";
+                    global << "    {\n";
+
+                    global << "        std::vector<std::string> scopePath;\n";
+                    for (unsigned int i = 0; i < iter->second.scopePath.size(); i++)
+                    {
+                        global << "        scopePath.push_back(\"" << iter->second.scopePath[i] << "\");\n";
+                    }
+
+                    vector<string>::iterator enumIter = iter->second.values.begin();
+                    for (; enumIter != iter->second.values.end(); enumIter++)
+                    {
+                        global << "        sc->registerConstantString(\"" << *enumIter << "\", \"" << *enumIter << "\", scopePath);\n";
+                    }
+
+                    global << "    }\n";
+                }
+            }
+            global << "}\n\n";
+            
+            // Write out the binding functions.
+            for (map<string, vector<FunctionBinding> >::iterator iter = _functions.begin(); iter != _functions.end(); iter++)
+            {
+                FunctionBinding::write(global, iter->second);
+            }
+
+            // Write out the enum conversion functions.
+            for (map<string, EnumBinding>::iterator iter = _enums.begin(); iter != _enums.end(); iter++)
+            {
+                // Build the scope string if applicable.
+                string scope;
+                if (iter->second.scopePath.size() > 0)
+                {
+                    for (unsigned int i = 0; i < iter->second.scopePath.size(); i++)
+                    {
+                        scope += iter->second.scopePath[i] + string("::");
+                    }
+                }
+
+                global << iter->first << " lua_enumFromString_" << getUniqueName(iter->first) << "(const char* s)\n";
+                global << "{\n";
+                
+                for (unsigned int i = 0; i < iter->second.values.size(); i++)
+                {
+                    global << "    ";
+                        
+                    global << "if (strcmp(s, \"" << iter->second.values[i] << "\") == 0)\n";
+                    global << "        return ";
+                    if (scope.size() > 0)
+                        global << scope;
+                    global << iter->second.values[i] << ";\n";
+
+                    if (i == iter->second.values.size() - 1)
+                    {
+                        global << "    GP_ERROR(\"Invalid enumeration value '%s' for enumeration " << iter->first << ".\", s);\n";
+                        global << "    return ";
+                        if (scope.size() > 0)
+                            global << scope;
+                        global << iter->second.values[0] << ";\n";
+                    }
+                }
+
+                global << "}\n\n";
+
+                global << "std::string lua_stringFromEnum_" << getUniqueName(iter->first) << "(" << iter->first << " e)\n";
+                global << "{\n";
+                
+                for (unsigned int i = 0; i < iter->second.values.size(); i++)
+                {
+                    global << "    ";
+                        
+                    global << "if (e == ";
+                    if (scope.size() > 0)
+                        global << scope;
+                    global << iter->second.values[i] << ")\n";
+                    global << "        return std::string(\"" << iter->second.values[i] << "\");\n";
+
+                    if (i == iter->second.values.size() - 1)
+                    {
+                        global << "    GP_ERROR(\"Invalid enumeration value '%d' for enumeration " << iter->first << ".\", e);\n";
+                        global << "    return std::string();\n";
+                    }
+                }
+
+                global << "}\n\n";
+            }
+
+            if (bindingNS)
+                global << "}\n";
+            global.close();
+        }
+    }
+
+end:
+    luaAllCpp << "}\n\n";
+    if (bindingNS)
+        luaAllCpp << "}\n\n";
+    luaAllCpp.close();
+
+    if (bindingNS)
+    {
+        luaAllH << "\nnamespace " << *bindingNS << "\n";
+        luaAllH << "{\n\n";
+    }
+    luaAllH << "void lua_RegisterAllBindings();\n\n";
+    if (bindingNS)
+        luaAllH<< "}\n\n";
+    luaAllH << "#endif\n";
+    luaAllH.close();
+
+    SAFE_DELETE(bindingNS);
+}
+
+void Generator::getAllDerived(set<string>& derived, string classname)
+{
+    for (unsigned int i = 0, count = _classes[classname].derived.size(); i < count; i++)
+    {
+        string derivedClassName = getIdentifier(_classes[classname].derived[i]);
+        derived.insert(derivedClassName);
+        getAllDerived(derived, derivedClassName);
+    }
+}
+
+// ----------------------------------------------------------------------------
+// Utility functions
+
+static string trim(const string& str)
+{
+    string s = str;
+    while (isspace(s[0]))
+    {
+        s.erase(s.begin());
+    }
+    while (isspace(s[s.size() - 1]))
+    {
+        s.erase(s.begin() + s.size() - 1);
+    }
+    return s;
+}
+
+static string stripTypeQualifiers(const string& typeStr, FunctionBinding::Param::Kind& kind)
+{
+    string type = typeStr;
+    kind = FunctionBinding::Param::KIND_VALUE;
+
+    // Check if the type is a reference.
+    string::size_type i = type.find("&");
+    if (i != type.npos)
+    {
+        kind = FunctionBinding::Param::KIND_REFERENCE;
+        type.erase(type.begin() + i);
+    }
+
+    // Check if the type is a pointer.
+    i = type.find("*");
+    if (i != type.npos)
+    {
+        kind = FunctionBinding::Param::KIND_POINTER;
+        type.erase(type.begin() + i);
+    }
+
+    // Ignore const qualifiers.
+    i = type.find("const ");
+    if (i != type.npos)
+    {
+        type.erase(type.begin() + i, type.begin() + i + 6);
+    }
+
+    return trim(type);
+}
+
+static inline bool isWantedFileNormal(const string& s)
+{
+    if (s.find(".xml") == s.size() - 4)
+    {
+        if (s.find("class") == 0 || s.find("struct") == 0 || (s.find("_") == 0 && s.find("h.xml") != s.npos))
+            return true;
+    }
+    return false;
+}
+
+static inline bool isNamespaceFile(const string& s)
+{
+    if (s.find(".xml") == s.size() - 4)
+    {
+        if (s.find("namespace") == 0)
+            return true;
+    }
+    return false;
+}
+
+static bool getFileList(string directory, vector<string>& files, bool (*isWantedFile)(const string& s))
+{
+#ifdef WIN32
+    string path = directory + string("/*");
+
+    // Convert char to wchar.
+    basic_string<TCHAR> wPath;
+    wPath.assign(path.begin(), path.end());
+
+    WIN32_FIND_DATA FindFileData;
+    HANDLE hFind = FindFirstFile(wPath.c_str(), &FindFileData);
+    if (hFind == INVALID_HANDLE_VALUE) 
+    {
+        return false;
+    }
+    do
+    {
+        // Add to the list if this is not a directory and it passes the test function.
+        if ((FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
+        {
+            // Convert wchar to char.
+            basic_string<TCHAR> wfilename(FindFileData.cFileName);
+            string filename;
+            filename.assign(wfilename.begin(), wfilename.end());
+
+            if (isWantedFile(filename))
+            {
+                filename = string(directory) + string("/") + filename;
+                files.push_back(filename);
+            }
+        }
+    } while (FindNextFile(hFind, &FindFileData) != 0);
+
+    FindClose(hFind);
+    return true;
+#else
+    string path = directory + string("/.");
+    struct dirent* dp;
+    DIR* dir = opendir(path.c_str());
+    if (!dir)
+    {
+        return false;
+    }
+    while ((dp = readdir(dir)) != NULL)
+    {
+        string filepath(path);
+        filepath.append("/");
+        filepath.append(dp->d_name);
+
+        struct stat buf;
+        if (!stat(filepath.c_str(), &buf))
+        {
+            // Add to the list if this is not a directory and it passes the test function.
+            if (!S_ISDIR(buf.st_mode))
+            {
+                string filename = dp->d_name;
+                if (isWantedFile(filename))
+                {
+                    if (includePath)
+                        filename = string(directory) + filename;
+
+                    files.push_back(filename);
+                }
+            }
+        }
+    }
+    closedir(dir);
+    return true;
+#endif
+}
+
+// ----------------------------------------------------------------------------

+ 191 - 0
gameplay-luagen/src/Generator.h

@@ -0,0 +1,191 @@
+#ifndef GENERATOR_H_
+#define GENERATOR_H_
+
+#include "Base.h"
+#include "ClassBinding.h"
+#include "EnumBinding.h"
+#include "FunctionBinding.h"
+#include "Generator.h"
+#include "TypedefBinding.h"
+
+#include <tinyxml2.h>
+using namespace tinyxml2;
+
+/**
+ * Generates script bindings.
+ */
+class Generator
+{
+public:
+
+    /**
+     * Retrieves the global instance of the generator.
+     * 
+     * @return The global instance of the generator.
+     */
+    static Generator* getInstance();
+
+    /**
+     * Releases the global instance of the generator.
+     */
+    static void releaseInstance();
+
+    /**
+     * Retrieves the unique name for the given identifier (class, struct, enum, etc.).
+     * 
+     * @param name The identifier's name.
+     * @return The unique name.
+     */
+    static string getUniqueName(string name);
+
+    /**
+     * Retrieves the unique name for the given ref id.
+     * 
+     * @param refId The ref id.
+     * @return The unique name.
+     */
+    string getUniqueNameFromRef(string refId);
+
+    /**
+     * Gets the scope path for a given fully resolved classname.
+     * 
+     * @param classname The class name.
+     * @param ns The namespace of the class if it has one.
+     * @return The scope path.
+     */
+    static vector<string> getScopePath(string classname, string ns = string());
+
+    /**
+     * Retrieves the class/struct/enum name for the given ref id.
+     * 
+     * @param refId The ref id.
+     * @return The class/struct/enum name.
+     */
+    string getIdentifier(string refId);
+
+    /**
+     * Gets the given class name without the namespace.
+     * 
+     * @param classname The fully qualified name of the class.
+     * @return The class name without the namespace.
+     */
+    string getClassNameWithoutNamespace(string classname);
+
+    /**
+     * Sets the given ref id and class/struct/enum name pair.
+     * 
+     * @param refId The ref id.
+     * @param classname The class/struct/enum name.
+     */
+    void setIdentifier(string refId, string classname);
+
+    /**
+     * Generates Lua bindings for all classes defined within the given input directory
+     * and places the generated class bindings in the given output directory.
+     * Note that the input directory must point to a folder containing the Doxygen XML 
+     * output files for the classes that the user wants to generate bindings for.
+     * 
+     * @param inDir The input directory (must contain Doxygen XML output files).
+     * @param outDir The output directory.
+     */
+    void run(string inDir, string outDir);
+
+    /**
+     * Retrieves whether the given class is derived from Ref.
+     * 
+     * @param classname The name of the class.
+     * @return True if the class is derived from Ref; false otherwise.
+     */
+    bool isRef(string classname);
+
+protected:
+    /**
+     * Constructor.
+     */
+    Generator();
+
+    /**
+     * Destructor.
+     */
+    ~Generator();
+
+    // Checks if the given class name specifies a class derived from the class represented by the given class binding.
+    bool isDerived(const ClassBinding& c, string classname);
+
+    // Gets the name of the namespace, file, class, or struct.
+    string getCompoundName(XMLElement* node);
+
+    // Parses the non-member functions and adds them to the list.
+    void getFunctions(XMLElement* classNode);
+
+    // Parses the namespace (with the given name).
+    void getNamespace(XMLElement* nsNode, const string& name);
+
+    // Parses the class (with the given name) and adds it to the list.
+    void getClass(XMLElement* classNode, const string& name);
+
+    // Parses all enumerations within a file (optionally within a namespace).
+    void getEnums(XMLElement* fileNode, string ns = "");
+    
+    // Parses the enumeration type and adds it to the global list.
+    void getEnum(XMLElement* e, string classname = "", string ns = "", string include = "");
+
+    // Parses all typedefs within a file (optionall within a namespace).
+    void getTypedefs(XMLElement* fileNode, string ns = "");
+
+    // Parses the typedef and adds it to the global list.
+    void getTypedef(XMLElement* e, string classname = "", string ns = "");
+
+    // Gets the script flag if it is specified.
+    string getScriptFlag(XMLElement* e);
+
+    // Gets whether the current function has been marked as a creation function
+    // (indicating that the return value is owned by the script runtime and not C++).
+    void getCreateFlag(XMLElement* e, FunctionBinding& b);
+
+    // Gets the name of the binding.
+    string getName(XMLElement* e);
+
+    // Gets whether the type is const or not.
+    bool getIsConstType(XMLElement* e);
+
+    // Gets the parameter or return value, optionally within the scope of the given class.
+    FunctionBinding::Param getParam(XMLElement* e, bool isVariable = false,  string classname = "");
+
+    // Gets all of the parameters for a function.
+    void getParams(XMLElement* e, FunctionBinding& b);
+
+    // Resolves members for all classes' derived from class 'c'.
+    void resolveMembers(const ClassBinding& c);
+
+    // Resolves the inheritance.
+    void resolveInheritance();
+
+    // Resolves the type for a single parameter/return value (also takes the function that the parameter/return value is for).
+    void resolveType(FunctionBinding::Param* param, string functionName);
+
+    // Resolves all unrecognized types.
+    void resolveTypes();
+
+    // Generates the bindings to C++ header and source files.
+    void generateBindings();
+    
+    // Gets the set off all classes that derives from the given class.
+    void getAllDerived(set<string>& derived, string classname);
+
+private:
+    static Generator* __instance;
+
+    const char* _file;
+    map<string, string> _refIds;
+    string _outDir;
+    map<string, ClassBinding> _classes;
+    vector<string> _topLevelBaseClasses;
+    set<string> _includes;
+    map<string, vector<FunctionBinding> > _functions;
+    map<string, EnumBinding> _enums;
+    map<string, vector<string> > _namespaces;
+    map<string, TypedefBinding> _typedefs;
+};
+
+#endif

+ 16 - 0
gameplay-luagen/src/TypedefBinding.h

@@ -0,0 +1,16 @@
+#ifndef TYPEDEFBINDING_H_
+#define TYPEDEFBINDING_H_
+
+/**
+ * Represents a typedef.
+ * 
+ * Note: the name of the typedef is stored as the key in the 
+ * map containing all typedefs. The refId member is set if
+ * the typedef is a class, struct, or enumerated type.
+ */
+struct TypedefBinding
+{
+    string refId;
+};
+
+#endif

+ 36 - 0
gameplay-luagen/src/main.cpp

@@ -0,0 +1,36 @@
+#include "Base.h"
+#include "Generator.h"
+
+//TRACK_MEMORY();
+
+void printError(const char* format, ...)
+{
+    va_list argptr;
+    va_start(argptr, format);
+    int sz = vfprintf(stderr, format, argptr);
+    if (sz > 0)
+    {
+        char* buf = new char[sz + 1];
+        vsprintf(buf, format, argptr);
+        buf[sz] = 0;
+        OutputDebugStringA(buf);
+        SAFE_DELETE_ARRAY(buf);
+    }
+    va_end(argptr);
+}
+
+int main(int argc, char** argv)
+{
+    // Ensure the user is calling the program correctly.
+    if (argc < 2 || argc > 3)
+    {
+        GP_ERROR("Usage: luagen <input-directory> [output-directory]");
+    }
+
+    // Generate the bindings.
+    Generator::getInstance()->run(argv[1], (argc == 3) ? argv[2] : argv[1]);
+    Generator::releaseInstance();
+
+    system("pause");
+    return 0;
+}

+ 18 - 26
gameplay.doxyfile

@@ -1,4 +1,4 @@
-# Doxyfile 1.8.0
+# Doxyfile 1.8.1
 
 # This file describes the settings to be used by the documentation system
 # doxygen (www.doxygen.org) for a project
@@ -194,7 +194,7 @@ SEPARATE_MEMBER_PAGES  = NO
 # The TAB_SIZE tag can be used to set the number of spaces in a tab. 
 # Doxygen uses this value to replace tabs by spaces in code fragments.
 
-TAB_SIZE               = 8
+TAB_SIZE               = 4
 
 # This tag can be used to specify a number of aliases that acts 
 # as commands in the documentation. An alias has the form "name=value". 
@@ -203,7 +203,7 @@ TAB_SIZE               = 8
 # will result in a user-defined paragraph with heading "Side Effects:". 
 # You can put \n's in the value part of an alias to insert newlines.
 
-ALIASES                = 
+ALIASES                = "script{1} = \xmlonly <xmlonly>\1</xmlonly> \endxmlonly"
 
 # This tag can be used to specify a number of word-keyword mappings (TCL only). 
 # A mapping has the form "name=value". For example adding 
@@ -564,12 +564,6 @@ MAX_INITIALIZER_LINES  = 30
 
 SHOW_USED_FILES        = NO
 
-# If the sources in your project are distributed over multiple directories 
-# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
-# in the documentation. The default is NO.
-
-SHOW_DIRECTORIES       = NO
-
 # Set the SHOW_FILES tag to NO to disable the generation of the Files page. 
 # This will remove the Files entry from the Quick Index and from the 
 # Folder Tree View (if specified). The default is YES.
@@ -954,20 +948,23 @@ HTML_COLORSTYLE_GAMMA  = 80
 
 HTML_TIMESTAMP         = YES
 
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
-# files or namespaces will be aligned in HTML using tables. If set to 
-# NO a bullet list will be used.
-
-HTML_ALIGN_MEMBERS     = YES
-
 # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML 
 # documentation will contain sections that can be hidden and shown after the 
-# page has loaded. For this to work a browser that supports 
-# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox 
-# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
+# page has loaded.
 
 HTML_DYNAMIC_SECTIONS  = NO
 
+# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of 
+# entries shown in the various tree structured indices initially; the user 
+# can expand and collapse entries dynamically later on. Doxygen will expand 
+# the tree to such a level that at most the specified number of entries are 
+# visible (unless a fully collapsed tree already exceeds this amount). 
+# So setting the number of entries 1 will produce a full collapsed tree by 
+# default. 0 is a special value representing an infinite number of entries 
+# and will result in a full expanded tree by default.
+
+HTML_INDEX_NUM_ENTRIES = 100
+
 # If the GENERATE_DOCSET tag is set to YES, additional index files 
 # will be generated that can be used as input for Apple's Xcode 3 
 # integrated development environment, introduced with OSX 10.5 (Leopard). 
@@ -1146,11 +1143,6 @@ GENERATE_TREEVIEW      = NO
 
 ENUM_VALUES_PER_LINE   = 4
 
-# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, 
-# and Class Hierarchy pages using a tree view instead of an ordered list.
-
-USE_INLINE_TREES       = NO
-
 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
 # used to set the initial width (in pixels) of the frame in which the tree 
 # is shown.
@@ -1400,7 +1392,7 @@ MAN_LINKS              = NO
 # generate an XML file that captures the structure of 
 # the code including all documentation.
 
-GENERATE_XML           = NO
+GENERATE_XML           = YES
 
 # The XML_OUTPUT tag is used to specify where the XML pages will be put. 
 # If a relative path is entered the value of OUTPUT_DIRECTORY will be 
@@ -1425,7 +1417,7 @@ XML_DTD                =
 # and cross-referencing information) to the XML output. Note that 
 # enabling this will significantly increase the size of the XML output.
 
-XML_PROGRAMLISTING     = YES
+XML_PROGRAMLISTING     = NO
 
 #---------------------------------------------------------------------------
 # configuration options for the AutoGen Definitions output
@@ -1713,7 +1705,7 @@ CALLER_GRAPH           = NO
 
 GRAPHICAL_HIERARCHY    = YES
 
-# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES 
 # then doxygen will show the dependencies a directory has on other directories 
 # in a graphical way. The dependency relations are determined by the #include 
 # relations between the files in the directories.

+ 226 - 4
gameplay/gameplay.vcxproj

@@ -53,6 +53,116 @@
     <ClCompile Include="src\Label.cpp" />
     <ClCompile Include="src\Layout.cpp" />
     <ClCompile Include="src\Light.cpp" />
+    <ClCompile Include="src\lua\lua_AbsoluteLayout.cpp" />
+    <ClCompile Include="src\lua\lua_all_bindings.cpp" />
+    <ClCompile Include="src\lua\lua_Animation.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationClip.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationClipListener.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationController.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationTarget.cpp" />
+    <ClCompile Include="src\lua\lua_AnimationValue.cpp" />
+    <ClCompile Include="src\lua\lua_AudioBuffer.cpp" />
+    <ClCompile Include="src\lua\lua_AudioController.cpp" />
+    <ClCompile Include="src\lua\lua_AudioListener.cpp" />
+    <ClCompile Include="src\lua\lua_AudioSource.cpp" />
+    <ClCompile Include="src\lua\lua_BoundingBox.cpp" />
+    <ClCompile Include="src\lua\lua_BoundingSphere.cpp" />
+    <ClCompile Include="src\lua\lua_Bundle.cpp" />
+    <ClCompile Include="src\lua\lua_Button.cpp" />
+    <ClCompile Include="src\lua\lua_Camera.cpp" />
+    <ClCompile Include="src\lua\lua_CheckBox.cpp" />
+    <ClCompile Include="src\lua\lua_Container.cpp" />
+    <ClCompile Include="src\lua\lua_Control.cpp" />
+    <ClCompile Include="src\lua\lua_ControlListener.cpp" />
+    <ClCompile Include="src\lua\lua_Curve.cpp" />
+    <ClCompile Include="src\lua\lua_DepthStencilTarget.cpp" />
+    <ClCompile Include="src\lua\lua_Effect.cpp" />
+    <ClCompile Include="src\lua\lua_FileSystem.cpp" />
+    <ClCompile Include="src\lua\lua_FlowLayout.cpp" />
+    <ClCompile Include="src\lua\lua_Font.cpp" />
+    <ClCompile Include="src\lua\lua_FontGlyph.cpp" />
+    <ClCompile Include="src\lua\lua_FontText.cpp" />
+    <ClCompile Include="src\lua\lua_Form.cpp" />
+    <ClCompile Include="src\lua\lua_FrameBuffer.cpp" />
+    <ClCompile Include="src\lua\lua_Frustum.cpp" />
+    <ClCompile Include="src\lua\lua_Game.cpp" />
+    <ClCompile Include="src\lua\lua_Global.cpp" />
+    <ClCompile Include="src\lua\lua_Image.cpp" />
+    <ClCompile Include="src\lua\lua_Joint.cpp" />
+    <ClCompile Include="src\lua\lua_Joystick.cpp" />
+    <ClCompile Include="src\lua\lua_Keyboard.cpp" />
+    <ClCompile Include="src\lua\lua_Label.cpp" />
+    <ClCompile Include="src\lua\lua_Layout.cpp" />
+    <ClCompile Include="src\lua\lua_Light.cpp" />
+    <ClCompile Include="src\lua\lua_Material.cpp" />
+    <ClCompile Include="src\lua\lua_MaterialParameter.cpp" />
+    <ClCompile Include="src\lua\lua_MathUtil.cpp" />
+    <ClCompile Include="src\lua\lua_Matrix.cpp" />
+    <ClCompile Include="src\lua\lua_Mesh.cpp" />
+    <ClCompile Include="src\lua\lua_MeshBatch.cpp" />
+    <ClCompile Include="src\lua\lua_MeshPart.cpp" />
+    <ClCompile Include="src\lua\lua_MeshSkin.cpp" />
+    <ClCompile Include="src\lua\lua_Model.cpp" />
+    <ClCompile Include="src\lua\lua_Mouse.cpp" />
+    <ClCompile Include="src\lua\lua_Node.cpp" />
+    <ClCompile Include="src\lua\lua_NodeCloneContext.cpp" />
+    <ClCompile Include="src\lua\lua_ParticleEmitter.cpp" />
+    <ClCompile Include="src\lua\lua_Pass.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCharacter.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObject.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionListener.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionPair.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShape.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShapeDefinition.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsController.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsControllerHitResult.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsControllerListener.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsFixedConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsGenericConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsGhostObject.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsHingeConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsRigidBody.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsRigidBodyParameters.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsSocketConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_PhysicsSpringConstraint.cpp" />
+    <ClCompile Include="src\lua\lua_Plane.cpp" />
+    <ClCompile Include="src\lua\lua_Platform.cpp" />
+    <ClCompile Include="src\lua\lua_Properties.cpp" />
+    <ClCompile Include="src\lua\lua_Quaternion.cpp" />
+    <ClCompile Include="src\lua\lua_RadioButton.cpp" />
+    <ClCompile Include="src\lua\lua_Ray.cpp" />
+    <ClCompile Include="src\lua\lua_Rectangle.cpp" />
+    <ClCompile Include="src\lua\lua_Ref.cpp" />
+    <ClCompile Include="src\lua\lua_RenderState.cpp" />
+    <ClCompile Include="src\lua\lua_RenderStateStateBlock.cpp" />
+    <ClCompile Include="src\lua\lua_RenderTarget.cpp" />
+    <ClCompile Include="src\lua\lua_Scene.cpp" />
+    <ClCompile Include="src\lua\lua_SceneLoader.cpp" />
+    <ClCompile Include="src\lua\lua_ScreenDisplayer.cpp" />
+    <ClCompile Include="src\lua\lua_ScriptController.cpp" />
+    <ClCompile Include="src\lua\lua_Slider.cpp" />
+    <ClCompile Include="src\lua\lua_SpriteBatch.cpp" />
+    <ClCompile Include="src\lua\lua_Technique.cpp" />
+    <ClCompile Include="src\lua\lua_TextBox.cpp" />
+    <ClCompile Include="src\lua\lua_Texture.cpp" />
+    <ClCompile Include="src\lua\lua_TextureSampler.cpp" />
+    <ClCompile Include="src\lua\lua_Theme.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeSideRegions.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeStyle.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeThemeImage.cpp" />
+    <ClCompile Include="src\lua\lua_ThemeUVs.cpp" />
+    <ClCompile Include="src\lua\lua_Touch.cpp" />
+    <ClCompile Include="src\lua\lua_Transform.cpp" />
+    <ClCompile Include="src\lua\lua_TransformListener.cpp" />
+    <ClCompile Include="src\lua\lua_Uniform.cpp" />
+    <ClCompile Include="src\lua\lua_Vector2.cpp" />
+    <ClCompile Include="src\lua\lua_Vector3.cpp" />
+    <ClCompile Include="src\lua\lua_Vector4.cpp" />
+    <ClCompile Include="src\lua\lua_VertexAttributeBinding.cpp" />
+    <ClCompile Include="src\lua\lua_VertexFormat.cpp" />
+    <ClCompile Include="src\lua\lua_VertexFormatElement.cpp" />
+    <ClCompile Include="src\lua\lua_VerticalLayout.cpp" />
     <ClCompile Include="src\Material.cpp" />
     <ClCompile Include="src\MeshBatch.cpp" />
     <ClCompile Include="src\Pass.cpp" />
@@ -91,6 +201,7 @@
     <ClCompile Include="src\RenderTarget.cpp" />
     <ClCompile Include="src\Scene.cpp" />
     <ClCompile Include="src\SceneLoader.cpp" />
+    <ClCompile Include="src\ScriptController.cpp" />
     <ClCompile Include="src\Slider.cpp" />
     <ClCompile Include="src\SpriteBatch.cpp" />
     <ClCompile Include="src\Technique.cpp" />
@@ -145,6 +256,116 @@
     <ClInclude Include="src\Label.h" />
     <ClInclude Include="src\Layout.h" />
     <ClInclude Include="src\Light.h" />
+    <ClInclude Include="src\lua\lua_AbsoluteLayout.h" />
+    <ClInclude Include="src\lua\lua_all_bindings.h" />
+    <ClInclude Include="src\lua\lua_Animation.h" />
+    <ClInclude Include="src\lua\lua_AnimationClip.h" />
+    <ClInclude Include="src\lua\lua_AnimationClipListener.h" />
+    <ClInclude Include="src\lua\lua_AnimationController.h" />
+    <ClInclude Include="src\lua\lua_AnimationTarget.h" />
+    <ClInclude Include="src\lua\lua_AnimationValue.h" />
+    <ClInclude Include="src\lua\lua_AudioBuffer.h" />
+    <ClInclude Include="src\lua\lua_AudioController.h" />
+    <ClInclude Include="src\lua\lua_AudioListener.h" />
+    <ClInclude Include="src\lua\lua_AudioSource.h" />
+    <ClInclude Include="src\lua\lua_BoundingBox.h" />
+    <ClInclude Include="src\lua\lua_BoundingSphere.h" />
+    <ClInclude Include="src\lua\lua_Bundle.h" />
+    <ClInclude Include="src\lua\lua_Button.h" />
+    <ClInclude Include="src\lua\lua_Camera.h" />
+    <ClInclude Include="src\lua\lua_CheckBox.h" />
+    <ClInclude Include="src\lua\lua_Container.h" />
+    <ClInclude Include="src\lua\lua_Control.h" />
+    <ClInclude Include="src\lua\lua_ControlListener.h" />
+    <ClInclude Include="src\lua\lua_Curve.h" />
+    <ClInclude Include="src\lua\lua_DepthStencilTarget.h" />
+    <ClInclude Include="src\lua\lua_Effect.h" />
+    <ClInclude Include="src\lua\lua_FileSystem.h" />
+    <ClInclude Include="src\lua\lua_FlowLayout.h" />
+    <ClInclude Include="src\lua\lua_Font.h" />
+    <ClInclude Include="src\lua\lua_FontGlyph.h" />
+    <ClInclude Include="src\lua\lua_FontText.h" />
+    <ClInclude Include="src\lua\lua_Form.h" />
+    <ClInclude Include="src\lua\lua_FrameBuffer.h" />
+    <ClInclude Include="src\lua\lua_Frustum.h" />
+    <ClInclude Include="src\lua\lua_Game.h" />
+    <ClInclude Include="src\lua\lua_Global.h" />
+    <ClInclude Include="src\lua\lua_Image.h" />
+    <ClInclude Include="src\lua\lua_Joint.h" />
+    <ClInclude Include="src\lua\lua_Joystick.h" />
+    <ClInclude Include="src\lua\lua_Keyboard.h" />
+    <ClInclude Include="src\lua\lua_Label.h" />
+    <ClInclude Include="src\lua\lua_Layout.h" />
+    <ClInclude Include="src\lua\lua_Light.h" />
+    <ClInclude Include="src\lua\lua_Material.h" />
+    <ClInclude Include="src\lua\lua_MaterialParameter.h" />
+    <ClInclude Include="src\lua\lua_MathUtil.h" />
+    <ClInclude Include="src\lua\lua_Matrix.h" />
+    <ClInclude Include="src\lua\lua_Mesh.h" />
+    <ClInclude Include="src\lua\lua_MeshBatch.h" />
+    <ClInclude Include="src\lua\lua_MeshPart.h" />
+    <ClInclude Include="src\lua\lua_MeshSkin.h" />
+    <ClInclude Include="src\lua\lua_Model.h" />
+    <ClInclude Include="src\lua\lua_Mouse.h" />
+    <ClInclude Include="src\lua\lua_Node.h" />
+    <ClInclude Include="src\lua\lua_NodeCloneContext.h" />
+    <ClInclude Include="src\lua\lua_ParticleEmitter.h" />
+    <ClInclude Include="src\lua\lua_Pass.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCharacter.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObject.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionListener.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionPair.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShape.h" />
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShapeDefinition.h" />
+    <ClInclude Include="src\lua\lua_PhysicsConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsController.h" />
+    <ClInclude Include="src\lua\lua_PhysicsControllerHitResult.h" />
+    <ClInclude Include="src\lua\lua_PhysicsControllerListener.h" />
+    <ClInclude Include="src\lua\lua_PhysicsFixedConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsGenericConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsGhostObject.h" />
+    <ClInclude Include="src\lua\lua_PhysicsHingeConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsRigidBody.h" />
+    <ClInclude Include="src\lua\lua_PhysicsRigidBodyParameters.h" />
+    <ClInclude Include="src\lua\lua_PhysicsSocketConstraint.h" />
+    <ClInclude Include="src\lua\lua_PhysicsSpringConstraint.h" />
+    <ClInclude Include="src\lua\lua_Plane.h" />
+    <ClInclude Include="src\lua\lua_Platform.h" />
+    <ClInclude Include="src\lua\lua_Properties.h" />
+    <ClInclude Include="src\lua\lua_Quaternion.h" />
+    <ClInclude Include="src\lua\lua_RadioButton.h" />
+    <ClInclude Include="src\lua\lua_Ray.h" />
+    <ClInclude Include="src\lua\lua_Rectangle.h" />
+    <ClInclude Include="src\lua\lua_Ref.h" />
+    <ClInclude Include="src\lua\lua_RenderState.h" />
+    <ClInclude Include="src\lua\lua_RenderStateStateBlock.h" />
+    <ClInclude Include="src\lua\lua_RenderTarget.h" />
+    <ClInclude Include="src\lua\lua_Scene.h" />
+    <ClInclude Include="src\lua\lua_SceneLoader.h" />
+    <ClInclude Include="src\lua\lua_ScreenDisplayer.h" />
+    <ClInclude Include="src\lua\lua_ScriptController.h" />
+    <ClInclude Include="src\lua\lua_Slider.h" />
+    <ClInclude Include="src\lua\lua_SpriteBatch.h" />
+    <ClInclude Include="src\lua\lua_Technique.h" />
+    <ClInclude Include="src\lua\lua_TextBox.h" />
+    <ClInclude Include="src\lua\lua_Texture.h" />
+    <ClInclude Include="src\lua\lua_TextureSampler.h" />
+    <ClInclude Include="src\lua\lua_Theme.h" />
+    <ClInclude Include="src\lua\lua_ThemeSideRegions.h" />
+    <ClInclude Include="src\lua\lua_ThemeStyle.h" />
+    <ClInclude Include="src\lua\lua_ThemeThemeImage.h" />
+    <ClInclude Include="src\lua\lua_ThemeUVs.h" />
+    <ClInclude Include="src\lua\lua_Touch.h" />
+    <ClInclude Include="src\lua\lua_Transform.h" />
+    <ClInclude Include="src\lua\lua_TransformListener.h" />
+    <ClInclude Include="src\lua\lua_Uniform.h" />
+    <ClInclude Include="src\lua\lua_Vector2.h" />
+    <ClInclude Include="src\lua\lua_Vector3.h" />
+    <ClInclude Include="src\lua\lua_Vector4.h" />
+    <ClInclude Include="src\lua\lua_VertexAttributeBinding.h" />
+    <ClInclude Include="src\lua\lua_VertexFormat.h" />
+    <ClInclude Include="src\lua\lua_VertexFormatElement.h" />
+    <ClInclude Include="src\lua\lua_VerticalLayout.h" />
     <ClInclude Include="src\Material.h" />
     <ClInclude Include="src\MathUtil.h" />
     <ClInclude Include="src\MeshBatch.h" />
@@ -184,6 +405,7 @@
     <ClInclude Include="src\Scene.h" />
     <ClInclude Include="src\SceneLoader.h" />
     <ClInclude Include="src\ScreenDisplayer.h" />
+    <ClInclude Include="src\ScriptController.h" />
     <ClInclude Include="src\Slider.h" />
     <ClInclude Include="src\SpriteBatch.h" />
     <ClInclude Include="src\Technique.h" />
@@ -227,7 +449,6 @@
     <None Include="res\shaders\textured.vert" />
     <None Include="src\BoundingBox.inl" />
     <None Include="src\BoundingSphere.inl" />
-    <None Include="src\Curve.inl" />
     <None Include="src\Game.inl" />
     <None Include="src\gameplay-main-ios.mm" />
     <None Include="src\gameplay-main-macosx.mm" />
@@ -242,6 +463,7 @@
     <None Include="src\PlatformMacOSX.mm" />
     <None Include="src\Quaternion.inl" />
     <None Include="src\Ray.inl" />
+    <None Include="src\ScriptController.inl" />
     <None Include="src\Vector2.inl" />
     <None Include="src\Vector3.inl" />
     <None Include="src\Vector4.inl" />
@@ -313,7 +535,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>
       </RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -330,7 +552,7 @@
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeTypeInfo>true</RuntimeTypeInfo>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
     </ClCompile>
@@ -352,7 +574,7 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories>..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>

+ 726 - 63
gameplay/gameplay.vcxproj.filters

@@ -10,8 +10,8 @@
     <Filter Include="res\shaders">
       <UniqueIdentifier>{be0b36f1-49ed-4a06-9f1f-57c654a554fe}</UniqueIdentifier>
     </Filter>
-    <Filter Include="res\shaders\lib">
-      <UniqueIdentifier>{ab587dd0-fd08-4b5e-a38d-7b3a706ab53b}</UniqueIdentifier>
+    <Filter Include="lua">
+      <UniqueIdentifier>{21cf31c6-9c10-44cb-a864-d46a0e7bfe5e}</UniqueIdentifier>
     </Filter>
   </ItemGroup>
   <ItemGroup>
@@ -282,9 +282,339 @@
     <ClCompile Include="src\Joystick.cpp">
       <Filter>src</Filter>
     </ClCompile>
-    <ClCompile Include="src\Gamepad.cpp">
+    <ClCompile Include="src\ScriptController.cpp">
       <Filter>src</Filter>
     </ClCompile>
+    <ClCompile Include="src\lua\lua_AbsoluteLayout.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_all_bindings.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Animation.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AnimationClip.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AnimationClipListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AnimationController.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AnimationTarget.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AnimationValue.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AudioBuffer.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AudioController.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AudioListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_AudioSource.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_BoundingBox.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_BoundingSphere.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Bundle.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Button.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Camera.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_CheckBox.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Container.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Control.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ControlListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Curve.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_DepthStencilTarget.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Effect.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FileSystem.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FlowLayout.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Font.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FontGlyph.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FontText.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Form.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_FrameBuffer.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Frustum.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Game.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Global.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Image.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Joint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Joystick.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Keyboard.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Label.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Layout.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Light.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Material.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MaterialParameter.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MathUtil.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Matrix.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Mesh.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MeshBatch.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MeshPart.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_MeshSkin.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Model.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Mouse.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Node.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_NodeCloneContext.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ParticleEmitter.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Pass.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCharacter.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObject.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionObjectCollisionPair.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShape.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsCollisionShapeDefinition.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsController.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsControllerHitResult.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsControllerListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsFixedConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsGenericConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsGhostObject.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsHingeConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsRigidBody.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsRigidBodyParameters.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsSocketConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_PhysicsSpringConstraint.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Plane.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Platform.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Properties.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Quaternion.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_RadioButton.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Ray.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Rectangle.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Ref.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_RenderState.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_RenderStateStateBlock.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_RenderTarget.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Scene.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_SceneLoader.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ScreenDisplayer.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ScriptController.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Slider.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_SpriteBatch.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Technique.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_TextBox.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Texture.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_TextureSampler.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Theme.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ThemeSideRegions.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ThemeStyle.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ThemeThemeImage.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_ThemeUVs.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Touch.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Transform.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_TransformListener.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Uniform.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Vector2.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Vector3.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_Vector4.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_VertexAttributeBinding.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_VertexFormat.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_VertexFormatElement.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
+    <ClCompile Include="src\lua\lua_VerticalLayout.cpp">
+      <Filter>lua</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="src\Animation.h">
@@ -563,20 +893,407 @@
     <ClInclude Include="src\MathUtil.h">
       <Filter>src</Filter>
     </ClInclude>
-    <ClInclude Include="src\Gamepad.h">
+    <ClInclude Include="src\ScriptController.h">
       <Filter>src</Filter>
     </ClInclude>
+    <ClInclude Include="src\lua\lua_AbsoluteLayout.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_all_bindings.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Animation.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AnimationClip.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AnimationClipListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AnimationController.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AnimationTarget.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AnimationValue.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AudioBuffer.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AudioController.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AudioListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_AudioSource.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_BoundingBox.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_BoundingSphere.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Bundle.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Button.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Camera.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_CheckBox.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Container.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Control.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ControlListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Curve.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_DepthStencilTarget.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Effect.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FileSystem.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FlowLayout.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Font.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FontGlyph.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FontText.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Form.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_FrameBuffer.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Frustum.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Game.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Global.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Image.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Joint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Joystick.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Keyboard.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Label.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Layout.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Light.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Material.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MaterialParameter.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MathUtil.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Matrix.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Mesh.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MeshBatch.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MeshPart.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_MeshSkin.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Model.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Mouse.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Node.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_NodeCloneContext.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ParticleEmitter.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Pass.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCharacter.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObject.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionObjectCollisionPair.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShape.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsCollisionShapeDefinition.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsController.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsControllerHitResult.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsControllerListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsFixedConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsGenericConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsGhostObject.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsHingeConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsRigidBody.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsRigidBodyParameters.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsSocketConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_PhysicsSpringConstraint.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Plane.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Platform.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Properties.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Quaternion.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_RadioButton.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Ray.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Rectangle.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Ref.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_RenderState.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_RenderStateStateBlock.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_RenderTarget.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Scene.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_SceneLoader.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ScreenDisplayer.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ScriptController.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Slider.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_SpriteBatch.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Technique.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_TextBox.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Texture.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_TextureSampler.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Theme.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ThemeSideRegions.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ThemeStyle.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ThemeThemeImage.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_ThemeUVs.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Touch.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Transform.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_TransformListener.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Uniform.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Vector2.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Vector3.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_Vector4.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_VertexAttributeBinding.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_VertexFormat.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_VertexFormatElement.h">
+      <Filter>lua</Filter>
+    </ClInclude>
+    <ClInclude Include="src\lua\lua_VerticalLayout.h">
+      <Filter>lua</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
+    <None Include="res\shaders\bumped-specular.vsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\colored.fsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\colored.vsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\colored-specular.fsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\colored-specular.vsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\diffuse.fsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\diffuse.vsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\diffuse-specular.fsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\diffuse-specular.vsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\parallax.fsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\parallax.vsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\parallax-specular.fsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\parallax-specular.vsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\solid.fsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\solid.vsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\textured.fsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\textured.vsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\bumped.fsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\bumped.vsh">
+      <Filter>res\shaders</Filter>
+    </None>
+    <None Include="res\shaders\bumped-specular.fsh">
+      <Filter>res\shaders</Filter>
+    </None>
     <None Include="src\gameplay-main-macosx.mm">
       <Filter>src</Filter>
     </None>
     <None Include="src\PlatformMacOSX.mm">
       <Filter>src</Filter>
     </None>
-    <None Include="src\Curve.inl">
-      <Filter>src</Filter>
-    </None>
     <None Include="src\Game.inl">
       <Filter>src</Filter>
     </None>
@@ -613,62 +1330,8 @@
     <None Include="src\Joystick.inl">
       <Filter>src</Filter>
     </None>
-    <None Include="res\shaders\textured.vert">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\textured.frag">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\textured-unlit.vert">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\textured-unlit.frag">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\colored.vert">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\colored.frag">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\colored-unlit.vert">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\colored-unlit.frag">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\lib\lighting.frag">
-      <Filter>res\shaders\lib</Filter>
-    </None>
-    <None Include="res\shaders\lib\lighting-spot.vert">
-      <Filter>res\shaders\lib</Filter>
-    </None>
-    <None Include="res\shaders\lib\lighting-spot.frag">
-      <Filter>res\shaders\lib</Filter>
-    </None>
-    <None Include="res\shaders\lib\lighting-point.vert">
-      <Filter>res\shaders\lib</Filter>
-    </None>
-    <None Include="res\shaders\lib\lighting-point.frag">
-      <Filter>res\shaders\lib</Filter>
-    </None>
-    <None Include="res\shaders\lib\lighting-directional.vert">
-      <Filter>res\shaders\lib</Filter>
-    </None>
-    <None Include="res\shaders\lib\lighting-directional.frag">
-      <Filter>res\shaders\lib</Filter>
-    </None>
-    <None Include="res\shaders\lib\attributes.vert">
-      <Filter>res\shaders\lib</Filter>
-    </None>
-    <None Include="res\shaders\lib\attributes-skinning.vert">
-      <Filter>res\shaders\lib</Filter>
-    </None>
-    <None Include="res\shaders\textured-bumped.frag">
-      <Filter>res\shaders</Filter>
-    </None>
-    <None Include="res\shaders\textured-bumped.vert">
-      <Filter>res\shaders</Filter>
+    <None Include="src\ScriptController.inl">
+      <Filter>src</Filter>
     </None>
   </ItemGroup>
   <ItemGroup>

+ 1 - 0
gameplay/src/AudioListener.h

@@ -73,6 +73,7 @@ public:
      * Orientation is represented as 6 floats. (forward.x, forward.y, forward.z, up.x, up.y, up.z).
      * 
      * @return Pointer to the 6 orientation float values.
+     * @script{ignore}
      */
     const float* getOrientation() const;
 

+ 3 - 0
gameplay/src/Base.h

@@ -167,6 +167,9 @@ extern void printError(const char* format, ...);
 // Image
 #include <png.h>
 
+// Scripting
+#include <lua.hpp>
+
 #define WINDOW_VSYNC        1
 
 // Graphics (OpenGL)

+ 1 - 1
gameplay/src/BoundingBox.cpp

@@ -247,7 +247,7 @@ void BoundingBox::set(const Vector3& min, const Vector3& max)
     this->max = max;
 }
 
-void updateMinMax(Vector3* point, Vector3* min, Vector3* max)
+static void updateMinMax(Vector3* point, Vector3* min, Vector3* max)
 {
     GP_ASSERT(point);
     GP_ASSERT(min);

+ 0 - 8
gameplay/src/BoundingSphere.h

@@ -36,14 +36,6 @@ public:
      */
     BoundingSphere(const Vector3& center, float radius);
 
-    /**
-     * Constructs a new bounding sphere that contains all of the specified points.
-     *
-     * @param points The points to enclose inside the new bounding sphere.
-     * @param count The number of points.
-     */
-    BoundingSphere(Vector3* points, unsigned int count);
-
     /**
      * Constructs a bounding sphere from the given bounding sphere.
      *

+ 1 - 1
gameplay/src/Bundle.cpp

@@ -128,7 +128,7 @@ bool Bundle::readArray(unsigned int* length, std::vector<T>* values, unsigned in
     return true;
 }
 
-std::string readString(FILE* fp)
+static std::string readString(FILE* fp)
 {
     GP_ASSERT(fp);
 

+ 10 - 1
gameplay/src/Container.cpp

@@ -21,6 +21,15 @@ static const long SCROLL_INERTIA_DELAY = 100L;
 // Factor to multiply friction by before applying to velocity.
 static const float SCROLL_FRICTION_FACTOR = 5.0f;
 
+/**
+ * Sort function for use with _controls.sort(), based on Z-Order.
+ * 
+ * @param c1 The first control
+ * @param c2 The second control
+ * return true if the first controls z index is less than the second.
+ */
+static bool sortControlsByZOrder(Control* c1, Control* c2);
+
 Container::Container()
     : _layout(NULL), _scrollBarTopCap(NULL), _scrollBarVertical(NULL), _scrollBarBottomCap(NULL),
       _scrollBarLeftCap(NULL), _scrollBarHorizontal(NULL), _scrollBarRightCap(NULL),
@@ -1045,7 +1054,7 @@ Container::Scroll Container::getScroll(const char* scroll)
     return Container::SCROLL_NONE;
 }
 
-bool sortControlsByZOrder(Control* c1, Control* c2)
+static bool sortControlsByZOrder(Control* c1, Control* c2)
 {
     if (c1->getZIndex() < c2->getZIndex())
         return true;

+ 1 - 10
gameplay/src/Container.h

@@ -141,6 +141,7 @@ public:
      * Get the vector of controls within this container.
      *
      * @return The vector of the controls within this container.
+     * @script{ignore}
      */
     const std::vector<Control*>& getControls() const;
 
@@ -478,16 +479,6 @@ private:
     float _totalHeight;
 };
 
-
-/**
- * Sort funtion for use with _controls.sort(), based on Z-Order.
- * 
- * @param c1 The first control
- * @param c2 The second control
- * return true if the first controls z index is less than the second.
- */
-bool sortControlsByZOrder(Control* c1, Control* c2);
-
 }
 
 #endif

+ 5 - 7
gameplay/src/Control.cpp

@@ -222,6 +222,11 @@ void Control::setAutoHeight(bool autoHeight)
     }
 }
 
+bool Control::getAutoHeight() const
+{
+    return _autoHeight;
+}
+
 void Control::setOpacity(float opacity, unsigned char states)
 {
     overrideStyle();
@@ -285,13 +290,6 @@ const Rectangle& Control::getSkinRegion(State state) const
     return overlay->getSkinRegion();
 }
 
-const Theme::UVs& Control::getSkinUVs(Theme::Skin::SkinArea area, State state) const
-{
-    Theme::Style::Overlay* overlay = getOverlay(state);
-    GP_ASSERT(overlay);
-    return overlay->getSkinUVs(area);
-}
-
 void Control::setSkinColor(const Vector4& color, unsigned char states)
 {
     overrideStyle();

+ 1 - 10
gameplay/src/Control.h

@@ -83,6 +83,7 @@ public:
     };
 
     /**
+     * @script{ignore}
      * A constant used for setting themed attributes on all control states simultaneously.
      */
     static const unsigned char STATE_ALL = NORMAL | FOCUS | ACTIVE | DISABLED;
@@ -330,16 +331,6 @@ public:
      */
     const Rectangle& getSkinRegion(State state = NORMAL) const;
 
-    /**
-     * Get the texture coordinates of an area of this control's skin for a given state.
-     *
-     * @param area The area of the skin to get the coordinates of.
-     * @param state The state to get this property from.
-     *
-     * @return The texture coordinates of an area of this control's skin.
-     */
-    const Theme::UVs& getSkinUVs(Theme::Skin::SkinArea area, State state = NORMAL) const;
-
     /**
      * Set the blend color of this control's skin.
      *

+ 29 - 0
gameplay/src/Curve.cpp

@@ -50,6 +50,35 @@ using std::strcmp;
     }
 #endif
 
+static inline float bezier(float eq0, float eq1, float eq2, float eq3, float from, float out, float to, float in)
+{
+    return from * eq0 + out * eq1 + in * eq2 + to * eq3;
+}
+
+static inline float bspline(float eq0, float eq1, float eq2, float eq3, float c0, float c1, float c2, float c3)
+{
+    return c0 * eq0 + c1 * eq1 + c2 * eq2 + c3 * eq3;
+}
+
+static inline float hermite(float h00, float h01, float h10, float h11, float from, float out, float to, float in)
+{
+    return h00 * from + h01 * to + h10 * out + h11 * in;
+}
+
+static inline float hermiteFlat(float h00, float h01, float from, float to)
+{
+    return h00 * from + h01 * to;
+}
+
+static inline float hermiteSmooth(float h00, float h01, float h10, float h11, float from, float out, float to, float in)
+{
+    return h00 * from + h01 * to + h10 * out + h11 * in;
+}
+
+static inline float lerpInl(float s, float from, float to)
+{
+    return from + (to - from) * s;
+}
 
 namespace gameplay
 {

+ 0 - 14
gameplay/src/Curve.h

@@ -485,20 +485,6 @@ private:
     Point* _points;                     // The points on the curve.
 };
 
-inline static float bezier(float eq0, float eq1, float eq2, float eq3, float from, float out, float to, float in);
-
-inline static float bspline(float eq0, float eq1, float eq2, float eq3, float c0, float c1, float c2, float c3);
-
-inline static float hermite(float h00, float h01, float h10, float h11, float from, float out, float to, float in);
-
-inline static float hermiteFlat(float h00, float h01, float from, float to);
-
-inline static float hermiteSmooth(float h00, float h01, float h10, float h11, float from, float out, float to, float in);
-
-inline static float lerpInl(float s, float from, float to);
-
 }
 
-#include "Curve.inl"
-
 #endif

+ 0 - 36
gameplay/src/Curve.inl

@@ -1,36 +0,0 @@
-#include "Curve.h"
-
-namespace gameplay
-{
-
-inline float bezier(float eq0, float eq1, float eq2, float eq3, float from, float out, float to, float in)
-{
-    return from * eq0 + out * eq1 + in * eq2 + to * eq3;
-}
-
-inline float bspline(float eq0, float eq1, float eq2, float eq3, float c0, float c1, float c2, float c3)
-{
-    return c0 * eq0 + c1 * eq1 + c2 * eq2 + c3 * eq3;
-}
-
-inline float hermite(float h00, float h01, float h10, float h11, float from, float out, float to, float in)
-{
-    return h00 * from + h01 * to + h10 * out + h11 * in;
-}
-
-inline float hermiteFlat(float h00, float h01, float from, float to)
-{
-    return h00 * from + h01 * to;
-}
-
-inline float hermiteSmooth(float h00, float h01, float h10, float h11, float from, float out, float to, float in)
-{
-    return h00 * from + h01 * to + h10 * out + h11 * in;
-}
-
-inline float lerpInl(float s, float from, float to)
-{
-    return from + (to - from) * s;
-}
-
-}

+ 1 - 0
gameplay/src/FileSystem.cpp

@@ -68,6 +68,7 @@ void makepath(std::string path, int mode)
 }
 #endif
 
+/** @script{ignore} */
 static std::string __resourcePath("./");
 static std::map<std::string, std::string> __aliases;
 

+ 2 - 0
gameplay/src/FileSystem.h

@@ -89,6 +89,7 @@ public:
      * @param files The vector to append the files to.
      * 
      * @return True if successful, false if error.
+     * @script{ignore}
      */
     static bool listFiles(const char* dirPath, std::vector<std::string>& files);
 
@@ -110,6 +111,7 @@ public:
      * @param mode The mode used to open the file, passed directly to fopen.
      * 
      * @see setResourcePath(const char*)
+     * @script{ignore}
      */
     static FILE* openFile(const char* filePath, const char* mode);
 

+ 112 - 2
gameplay/src/Game.cpp

@@ -4,6 +4,7 @@
 #include "RenderState.h"
 #include "FileSystem.h"
 #include "FrameBuffer.h"
+#include "SceneLoader.h"
 
 GLenum __gl_error_code = GL_NO_ERROR;
 ALenum __al_error_code = AL_NO_ERROR;
@@ -19,7 +20,8 @@ Game::Game()
     : _initialized(false), _state(UNINITIALIZED), 
       _frameLastFPS(0), _frameCount(0), _frameRate(0), 
       _clearDepth(1.0f), _clearStencil(0), _properties(NULL),
-      _animationController(NULL), _audioController(NULL), _physicsController(NULL), _audioListener(NULL)
+      _animationController(NULL), _audioController(NULL), 
+      _physicsController(NULL), _audioListener(NULL), _scriptController(NULL)
 {
     GP_ASSERT(__gameInstance == NULL);
     __gameInstance = this;
@@ -102,6 +104,94 @@ bool Game::startup()
 
     loadGamepads();
     
+    _scriptController = new ScriptController();
+    _scriptController->initialize();
+
+    // Set the script callback functions.
+    if (_properties)
+    {
+        Properties* scripts = _properties->getNamespace("scripts", true);
+        if (scripts)
+        {
+            const char* name;
+            while ((name = scripts->getNextProperty()) != NULL)
+            {
+                if (strcmp(name, "INITIALIZE") == 0)
+                {
+                    std::string url = scripts->getString();
+                    std::string file;
+                    std::string id;
+                    splitURL(url, &file, &id);
+
+                    if (file.size() <= 0 || id.size() <= 0)
+                    {
+                        GP_ERROR("Invalid INITIALIZE script callback function '%s'.", url.c_str());
+                    }
+                    else
+                    {
+                        _scriptController->loadScript(file.c_str());
+                        _scriptController->registerCallback(ScriptController::INITIALIZE, id);
+                    }
+                }
+                else if (strcmp(name, "UPDATE") == 0)
+                {
+                    std::string url = scripts->getString();
+                    std::string file;
+                    std::string id;
+                    splitURL(url, &file, &id);
+
+                    if (file.size() <= 0 || id.size() <= 0)
+                    {
+                        GP_ERROR("Invalid UPDATE script callback function '%s'.", url.c_str());
+                    }
+                    else
+                    {
+                        _scriptController->loadScript(file.c_str());
+                        _scriptController->registerCallback(ScriptController::UPDATE, id);
+                    }
+                }
+                else if (strcmp(name, "RENDER") == 0)
+                {
+                    std::string url = scripts->getString();
+                    std::string file;
+                    std::string id;
+                    splitURL(url, &file, &id);
+
+                    if (file.size() <= 0 || id.size() <= 0)
+                    {
+                        GP_ERROR("Invalid RENDER script callback function '%s'.", url.c_str());
+                    }
+                    else
+                    {
+                        _scriptController->loadScript(file.c_str());
+                        _scriptController->registerCallback(ScriptController::RENDER, id);
+                    }
+                }
+                else if (strcmp(name, "FINALIZE") == 0)
+                {
+                    std::string url = scripts->getString();
+                    std::string file;
+                    std::string id;
+                    splitURL(url, &file, &id);
+
+                    if (file.size() <= 0 || id.size() <= 0)
+                    {
+                        GP_ERROR("Invalid FINALIZE script callback function '%s'.", url.c_str());
+                    }
+                    else
+                    {
+                        _scriptController->loadScript(file.c_str());
+                        _scriptController->registerCallback(ScriptController::FINALIZE, id);
+                    }
+                }
+                else
+                {
+                    // Ignore everything else.
+                }
+            }
+        }
+    }
+
     _state = RUNNING;
 
     return true;
@@ -118,6 +208,7 @@ void Game::shutdown()
 
         Platform::signalShutdown();
         finalize();
+
         
         for (std::vector<Gamepad*>::iterator itr = _gamepads.begin(); itr != _gamepads.end(); itr++)
         {
@@ -125,6 +216,8 @@ void Game::shutdown()
         }
         _gamepads.clear();
         
+        _scriptController->finalizeGame();
+
         _animationController->finalize();
         SAFE_DELETE(_animationController);
 
@@ -134,6 +227,9 @@ void Game::shutdown()
         _physicsController->finalize();
         SAFE_DELETE(_physicsController);
 
+        _scriptController->finalize();
+        SAFE_DELETE(_scriptController);
+
         SAFE_DELETE(_audioListener);
 
         RenderState::finalize();
@@ -184,6 +280,7 @@ void Game::frame()
     if (!_initialized)
     {
         initialize();
+        _scriptController->initializeGame();
         _initialized = true;
     }
 
@@ -211,12 +308,18 @@ void Game::frame()
         // Application Update.
         update(elapsedTime);
 
+        // Run script update.
+        _scriptController->update(elapsedTime);
+
         // Audio Rendering.
         _audioController->update(elapsedTime);
 
         // Graphics Rendering.
         render(elapsedTime);
-        
+
+        // Run script render.
+        _scriptController->render(elapsedTime);
+
         // Update FPS.
         ++_frameCount;
         if ((Game::getGameTime() - _frameLastFPS) >= 1000)
@@ -231,8 +334,14 @@ void Game::frame()
         // Application Update.
         update(0);
 
+        // Script update.
+        _scriptController->update(0);
+
         // Graphics Rendering.
         render(0);
+
+        // Script render.
+        _scriptController->render(0);
     }
 }
 
@@ -252,6 +361,7 @@ void Game::updateOnce()
     _animationController->update(elapsedTime);
     _physicsController->update(elapsedTime);
     _audioController->update(elapsedTime);
+    _scriptController->update(elapsedTime);
 }
 
 void Game::setViewport(const Rectangle& viewport)

+ 3 - 0
gameplay/src/Game.h

@@ -9,6 +9,7 @@
 #include "AudioController.h"
 #include "AnimationController.h"
 #include "PhysicsController.h"
+#include "ScriptController.h"
 #include "AudioListener.h"
 #include "Rectangle.h"
 #include "Vector4.h"
@@ -367,6 +368,7 @@ public:
      * @param timeOffset The number of game milliseconds in the future to schedule the event to be fired.
      * @param timeListener The TimeListener that will receive the event.
      * @param cookie The cookie data that the time event will contain.
+     * @script{ignore}
      */
     void schedule(float timeOffset, TimeListener* timeListener, void* cookie = 0);
 
@@ -496,6 +498,7 @@ private:
     AnimationController* _animationController;  // Controls the scheduling and running of animations.
     AudioController* _audioController;          // Controls audio sources that are playing in the game.
     PhysicsController* _physicsController;      // Controls the simulation of a physics scene and entities.
+    ScriptController* _scriptController;        // Controls the scripting engine.
     AudioListener* _audioListener;              // The audio listener in 3D space.
     std::vector<Gamepad*> _gamepads;            // The connected gamepads.
     std::priority_queue<TimeEvent, std::vector<TimeEvent>, std::less<TimeEvent> >* _timeEvents;     // Contains the scheduled time events.

+ 1 - 0
gameplay/src/Image.h

@@ -34,6 +34,7 @@ public:
      * Gets the image's raw pixel data.
      * 
      * @return The image's pixel data.
+     * @script{ignore}
      */
     inline unsigned char* getData() const;
 

+ 3 - 0
gameplay/src/Light.h

@@ -239,8 +239,11 @@ private:
     
     union
     {
+        /** @script{ignore} */
         Directional* _directional;
+        /** @script{ignore} */
         Point* _point;
+        /** @script{ignore} */
         Spot* _spot;
     };
     Node* _node;

+ 3 - 3
gameplay/src/Material.cpp

@@ -256,7 +256,7 @@ bool Material::loadPass(Technique* technique, Properties* passProperties)
     return true;
 }
 
-bool isMaterialKeyword(const char* str)
+static bool isMaterialKeyword(const char* str)
 {
     GP_ASSERT(str);
 
@@ -277,7 +277,7 @@ bool isMaterialKeyword(const char* str)
     return false;
 }
 
-Texture::Filter parseTextureFilterMode(const char* str, Texture::Filter defaultValue)
+static Texture::Filter parseTextureFilterMode(const char* str, Texture::Filter defaultValue)
 {
     if (str == NULL || strlen(str) == 0)
     {
@@ -315,7 +315,7 @@ Texture::Filter parseTextureFilterMode(const char* str, Texture::Filter defaultV
     }
 }
 
-Texture::Wrap parseTextureWrapMode(const char* str, Texture::Wrap defaultValue)
+static Texture::Wrap parseTextureWrapMode(const char* str, Texture::Wrap defaultValue)
 {
     if (str == NULL || strlen(str) == 0)
     {

+ 6 - 0
gameplay/src/MaterialParameter.h

@@ -248,11 +248,17 @@ private:
     
     union
     {
+        /** @script{ignore} */
         float floatValue;
+        /** @script{ignore} */
         int intValue;
+        /** @script{ignore} */
         float* floatPtrValue;
+        /** @script{ignore} */
         int* intPtrValue;
+        /** @script{ignore} */
         const Texture::Sampler* samplerValue;
+        /** @script{ignore} */
         MethodBinding* method;
     } _value;
     

+ 1 - 0
gameplay/src/Mesh.h

@@ -196,6 +196,7 @@ public:
      * @param vertexData The vertex data to be set.
      * @param vertexStart The index of the starting vertex (0 by default).
      * @param vertexCount The number of vertices to be set (default is 0, for all vertices).
+     * @script{ignore}
      */
     void setVertexData(void* vertexData, unsigned int vertexStart = 0, unsigned int vertexCount = 0);
 

+ 1 - 0
gameplay/src/MeshPart.h

@@ -70,6 +70,7 @@ public:
      * @param indexData The index data to be set.
      * @param indexStart The index to start from.
      * @param indexCount The number of indices to be set.
+     * @script{ignore}
      */
     void setIndexData(void* indexData, unsigned int indexStart, unsigned int indexCount);
 

+ 1 - 0
gameplay/src/Node.cpp

@@ -1,4 +1,5 @@
 #include "Base.h"
+#include "AudioSource.h"
 #include "Node.h"
 #include "Scene.h"
 #include "Joint.h"

+ 4 - 1
gameplay/src/Node.h

@@ -6,7 +6,6 @@
 #include "Light.h"
 #include "Model.h"
 #include "Form.h"
-#include "AudioSource.h"
 #include "ParticleEmitter.h"
 #include "PhysicsRigidBody.h"
 #include "PhysicsCollisionObject.h"
@@ -16,6 +15,7 @@
 namespace gameplay
 {
 
+class AudioSource;
 class Bundle;
 class Scene;
 class Form;
@@ -173,6 +173,7 @@ public:
      *
      * @return The user pointer for this node.
      * @see setUserPointer(void*)
+     * @script{ignore}
      */
     void* getUserPointer() const;
 
@@ -194,6 +195,7 @@ public:
      *      Node is being destroyed (or when the user pointer changes),
      *      to allow the user to cleanup any memory associated with the
      *      user pointer.
+     * @script{ignore}
      */
     void setUserPointer(void* pointer, void (*cleanupCallback)(void*) = NULL);
 
@@ -230,6 +232,7 @@ public:
      *        or false if nodes that start with the given ID are returned.
      * 
      * @return The number of matches found.
+     * @script{ignore}
      */
     unsigned int findNodes(const char* id, std::vector<Node*>& nodes, bool recursive = true, bool exactMatch = true) const;
 

+ 5 - 0
gameplay/src/ParticleEmitter.cpp

@@ -356,6 +356,11 @@ void ParticleEmitter::setEllipsoid(bool ellipsoid)
     _ellipsoid = ellipsoid;
 }
 
+bool ParticleEmitter::isEllipsoid() const
+{
+    return _ellipsoid;
+}
+
 void ParticleEmitter::setSize(float startMin, float startMax, float endMin, float endMax)
 {
     _sizeStartMin = startMin;

+ 1 - 0
gameplay/src/Pass.h

@@ -37,6 +37,7 @@ public:
 
     /**
      * Get a list of properties to be auto-bound.
+     * @script{ignore}
      */
     const std::vector<std::string>* getAutoBindProperties() const;
 

+ 6 - 3
gameplay/src/PhysicsCharacter.cpp

@@ -13,6 +13,9 @@
 namespace gameplay
 {
 
+/**
+ * @script{ignore}
+ */
 class ClosestNotMeConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback
 {
 public:
@@ -560,7 +563,7 @@ void PhysicsCharacter::stepDown(btCollisionWorld* collisionWorld, btScalar time)
 /*
  * Returns the reflection direction of a ray going 'direction' hitting a surface with normal 'normal'.
  */
-btVector3 computeReflectionDirection(const btVector3& direction, const btVector3& normal)
+static btVector3 computeReflectionDirection(const btVector3& direction, const btVector3& normal)
 {
     return direction - (btScalar(2.0) * direction.dot(normal)) * normal;
 }
@@ -568,7 +571,7 @@ btVector3 computeReflectionDirection(const btVector3& direction, const btVector3
 /*
  * Returns the portion of 'direction' that is parallel to 'normal'.
  */
-btVector3 parallelComponent(const btVector3& direction, const btVector3& normal)
+static btVector3 parallelComponent(const btVector3& direction, const btVector3& normal)
 {
     btScalar magnitude = direction.dot(normal);
     return normal * magnitude;
@@ -577,7 +580,7 @@ btVector3 parallelComponent(const btVector3& direction, const btVector3& normal)
 /*
  * Returns the portion of 'direction' that is perpindicular to 'normal'.
  */
-btVector3 perpindicularComponent(const btVector3& direction, const btVector3& normal)
+static btVector3 perpindicularComponent(const btVector3& direction, const btVector3& normal)
 {
     return direction - parallelComponent(direction, normal);
 }

+ 2 - 0
gameplay/src/PhysicsCharacter.h

@@ -167,11 +167,13 @@ public:
 
     /**
      * @see btActionInterface::updateAction
+     * @script{ignore}
      */
     void updateAction(btCollisionWorld* collisionWorld, btScalar deltaTimeStep);
 
     /**
      * @see btActionInterface::debugDraw
+     * @script{ignore}
      */
     void debugDraw(btIDebugDraw* debugDrawer);
 

+ 1 - 0
gameplay/src/PhysicsCollisionObject.cpp

@@ -9,6 +9,7 @@ namespace gameplay
 
 /**
  * Internal class used to implement the collidesWith(PhysicsCollisionObject*) function.
+ * @script{ignore}
  */
 struct CollidesWithCallback : public btCollisionWorld::ContactResultCallback
 {

+ 8 - 0
gameplay/src/PhysicsCollisionShape.h

@@ -94,10 +94,15 @@ public:
 
         union
         {
+            /** @script{ignore} */
             BoxData box;
+            /** @script{ignore} */
             SphereData sphere;
+            /** @script{ignore} */
             CapsuleData capsule;
+            /** @script{ignore} */
             Image* heightfield;
+            /** @script{ignore} */
             Mesh* mesh;
         } data;
 
@@ -119,6 +124,7 @@ public:
      * Returns the internal bullet physics shape object.
      *
      * @return The bullet shape object.
+     * @script{ignore}
      */
     btCollisionShape* getShape() const
     {
@@ -242,7 +248,9 @@ private:
     // Shape specific cached data
     union
     {
+        /** @script{ignore} */
         MeshData* meshData;
+        /** @script{ignore} */
         HeightfieldData* heightfieldData;
     } _shapeData;
 

+ 3 - 3
gameplay/src/PhysicsController.cpp

@@ -675,7 +675,7 @@ PhysicsCollisionObject* PhysicsController::getCollisionObject(const btCollisionO
     return reinterpret_cast<PhysicsCollisionObject*>(collisionObject->getUserPointer());
 }
 
-void getBoundingBox(Node* node, BoundingBox* out, bool merge = false)
+static void getBoundingBox(Node* node, BoundingBox* out, bool merge = false)
 {
     GP_ASSERT(node);
     GP_ASSERT(out);
@@ -701,7 +701,7 @@ void getBoundingBox(Node* node, BoundingBox* out, bool merge = false)
     }
 }
 
-void getBoundingSphere(Node* node, BoundingSphere* out, bool merge = false)
+static void getBoundingSphere(Node* node, BoundingSphere* out, bool merge = false)
 {
     GP_ASSERT(node);
     GP_ASSERT(out);
@@ -727,7 +727,7 @@ void getBoundingSphere(Node* node, BoundingSphere* out, bool merge = false)
     }
 }
 
-void computeCenterOfMass(const Vector3& center, const Vector3& scale, Vector3* centerOfMassOffset)
+static void computeCenterOfMass(const Vector3& center, const Vector3& scale, Vector3* centerOfMassOffset)
 {
     GP_ASSERT(centerOfMassOffset);
 

+ 5 - 1
gameplay/src/PhysicsController.h

@@ -448,13 +448,17 @@ private:
     // Removes the given constraint from the simulated physics world.
     void removeConstraint(PhysicsConstraint* constraint);
     
-    // Draws Bullet debug information.
+    /**
+     * Draws Bullet debug information.
+     * @script{ignore}
+     */
     class DebugDrawer : public btIDebugDraw
     {
     public:
 
         /** 
          * DebugVertex.
+         * @script{ignore}
          */
         struct DebugVertex
         {

+ 1 - 1
gameplay/src/Properties.cpp

@@ -598,7 +598,7 @@ bool Properties::exists(const char* name) const
     return _properties.find(name) != _properties.end();
 }
 
-const bool isStringNumeric(const char* str)
+static const bool isStringNumeric(const char* str)
 {
     GP_ASSERT(str);
 

+ 1 - 0
gameplay/src/Properties.h

@@ -164,6 +164,7 @@ public:
      * @param value Optional pointer to a const char* to store the value of the next property in.
      * 
      * @return The name of the next property, or NULL if there are no properties remaining.
+     * @script{ignore}
      */
     const char* getNextProperty(char** value = NULL);
 

+ 2 - 2
gameplay/src/RenderState.cpp

@@ -495,7 +495,7 @@ void RenderState::StateBlock::enableDepthWrite()
     }
 }
 
-bool parseBoolean(const char* value)
+static bool parseBoolean(const char* value)
 {
     GP_ASSERT(value);
 
@@ -511,7 +511,7 @@ bool parseBoolean(const char* value)
     return false;
 }
 
-RenderState::Blend parseBlend(const char* value)
+static RenderState::Blend parseBlend(const char* value)
 {
     GP_ASSERT(value);
 

+ 5 - 5
gameplay/src/Scene.cpp

@@ -278,7 +278,7 @@ void Scene::setAmbientColor(float red, float green, float blue)
     _ambientColor.set(red, green, blue);
 }
 
-Material* createDebugMaterial()
+static Material* createDebugMaterial()
 {
     // Vertex shader for drawing colored lines.
     const char* vs_str = 
@@ -356,7 +356,7 @@ struct DebugVertex
     float a;
 };
 
-void drawDebugLine(MeshBatch* batch, const Vector3& point1, const Vector3& point2, const Vector3& color)
+static void drawDebugLine(MeshBatch* batch, const Vector3& point1, const Vector3& point2, const Vector3& color)
 {
     GP_ASSERT(batch);
 
@@ -384,7 +384,7 @@ void drawDebugLine(MeshBatch* batch, const Vector3& point1, const Vector3& point
 #define DEBUG_BOX_COLOR Vector3(0, 1, 0)
 #define DEBUG_SPHERE_COLOR Vector3(0, 1, 0)
 
-void drawDebugBox(MeshBatch* batch, const BoundingBox& box, const Matrix& matrix)
+static void drawDebugBox(MeshBatch* batch, const BoundingBox& box, const Matrix& matrix)
 {
     // Transform box into world space (since we only store local boxes on mesh)
     BoundingBox worldSpaceBox(box);
@@ -409,7 +409,7 @@ void drawDebugBox(MeshBatch* batch, const BoundingBox& box, const Matrix& matrix
     drawDebugLine(batch, corners[3], corners[4], DEBUG_BOX_COLOR);
 }
 
-void drawDebugSphere(MeshBatch* batch, const BoundingSphere& sphere)
+static void drawDebugSphere(MeshBatch* batch, const BoundingSphere& sphere)
 {
     // Draw three rings for the sphere (one for the x, y and z axes)
     Vector3 pos1, pos2;
@@ -456,7 +456,7 @@ void drawDebugSphere(MeshBatch* batch, const BoundingSphere& sphere)
     }
 }
 
-void drawDebugNode(MeshBatch* batch, Node* node, unsigned int debugFlags)
+static void drawDebugNode(MeshBatch* batch, Node* node, unsigned int debugFlags)
 {
     GP_ASSERT(node);
     Model* model = node->getModel();

+ 1 - 0
gameplay/src/Scene.h

@@ -75,6 +75,7 @@ public:
      *      or false if nodes that start with the given ID are returned.
      * 
      * @return The number of matches found.
+     * @script{ignore}
      */
     unsigned int findNodes(const char* id, std::vector<Node*>& nodes, bool recursive = true, bool exactMatch = true) const;
 

+ 2 - 1
gameplay/src/SceneLoader.cpp

@@ -1,4 +1,5 @@
 #include "Base.h"
+#include "AudioSource.h"
 #include "Game.h"
 #include "Bundle.h"
 #include "SceneLoader.h"
@@ -972,7 +973,7 @@ PhysicsConstraint* SceneLoader::loadSpringConstraint(const Properties* constrain
     return physicsConstraint;
 }
 
-void SceneLoader::splitURL(const std::string& url, std::string* file, std::string* id)
+void splitURL(const std::string& url, std::string* file, std::string* id)
 {
     if (url.empty())
     {

+ 10 - 2
gameplay/src/SceneLoader.h

@@ -101,8 +101,6 @@ private:
     static PhysicsConstraint* loadSocketConstraint(const Properties* constraint, PhysicsRigidBody* rbA, PhysicsRigidBody* rbB);
 
     static PhysicsConstraint* loadSpringConstraint(const Properties* constraint, PhysicsRigidBody* rbA, PhysicsRigidBody* rbB);
-
-    static void splitURL(const std::string& url, std::string* file, std::string* id);
     
     
     static std::map<std::string, Properties*> _propertiesFromFile;      // Holds the properties object for a given file.
@@ -113,6 +111,16 @@ private:
     static std::string _path;                                           // The path of the scene file being loaded.
 };
 
+/**
+ * Utility function for splitting up a URL of the form 'file#id', where one or both of file and id may be empty.
+ * 
+ * @param url The url to split.
+ * @param file The out parameter containing the file part of the url.
+ * @param id The out parameter containing the id part of the url.
+ * @script{ignore}
+ */
+void splitURL(const std::string& url, std::string* file, std::string* id);
+
 }
 
 #endif

+ 621 - 0
gameplay/src/ScriptController.cpp

@@ -0,0 +1,621 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "lua/lua_all_bindings.h"
+
+namespace gameplay
+{
+
+ScriptController* ScriptController::__instance = NULL;
+
+#define GENERATE_LUA_GET_POINTER(type, checkFunc) \
+    /* Check that the parameter is the correct type. */ \
+    if (!lua_istable(_lua, index)) \
+    { \
+        if (lua_islightuserdata(_lua, index)) \
+            return (type*)lua_touserdata(_lua, index); \
+        lua_pushfstring(_lua, "Expected a " #type " pointer (an array represented as a Lua table), got '%s' instead.", luaL_typename(_lua, index)); \
+        lua_error(_lua); \
+        return NULL; \
+    } \
+    \
+    /* Create a vector to store the values. */ \
+    std::vector<type> values; \
+    \
+    /* Push the first key. */ \
+    lua_pushnil(_lua); \
+    while (lua_next(_lua, index) != 0) \
+    { \
+        values.push_back(checkFunc(_lua, -1)); \
+        \
+        /* Remove the value we just retrieved, but leave the key for the next iteration. */ \
+        lua_pop(_lua, 1); \
+    } \
+    \
+    /* Copy the values into an array. */ \
+    if (values.size() > 0) \
+    { \
+        type* ptr = new type[values.size()]; \
+        std::copy(values.begin(), values.end(), ptr); \
+        return ptr; \
+    } \
+    return NULL
+
+static bool luaCheckBool(lua_State* state, int n)
+{
+    if (!lua_isboolean(state, n))
+    {
+        const char* msg = lua_pushfstring(state, "%s expected, got %s", lua_typename(state, LUA_TBOOLEAN), luaL_typename(state, n));
+        luaL_argerror(state, n, msg);
+        return false;
+    }
+    return (lua_toboolean(state, n) != 0);
+}
+
+ScriptController* ScriptController::getInstance()
+{
+    return __instance;
+}
+
+bool* ScriptController::getBoolPointer(int index)
+{
+    GENERATE_LUA_GET_POINTER(bool, luaCheckBool);
+}
+
+short* ScriptController::getShortPointer(int index)
+{
+    GENERATE_LUA_GET_POINTER(short, (short)luaL_checkint);
+}
+
+int* ScriptController::getIntPointer(int index)
+{
+    GENERATE_LUA_GET_POINTER(int, (int)luaL_checkint);
+}
+
+long* ScriptController::getLongPointer(int index)
+{
+    GENERATE_LUA_GET_POINTER(long, (long)luaL_checkint);
+}
+
+unsigned char* ScriptController::getUnsignedCharPointer(int index)
+{
+    GENERATE_LUA_GET_POINTER(unsigned char, (unsigned char)luaL_checkunsigned);
+}
+
+unsigned short* ScriptController::getUnsignedShortPointer(int index)
+{
+    GENERATE_LUA_GET_POINTER(unsigned short, (unsigned short)luaL_checkunsigned);
+}
+
+unsigned int* ScriptController::getUnsignedIntPointer(int index)
+{
+    GENERATE_LUA_GET_POINTER(unsigned int, (unsigned int)luaL_checkunsigned);
+}
+
+unsigned long* ScriptController::getUnsignedLongPointer(int index)
+{
+    GENERATE_LUA_GET_POINTER(unsigned long, (unsigned long)luaL_checkunsigned);
+}
+
+float* ScriptController::getFloatPointer(int index)
+{
+    GENERATE_LUA_GET_POINTER(float, (float)luaL_checknumber);
+}
+
+double* ScriptController::getDoublePointer(int index)
+{
+    GENERATE_LUA_GET_POINTER(double, (double)luaL_checknumber);
+}
+
+void* ScriptController::getObjectPointer(int index, const char* type)
+{
+    void* p = lua_touserdata(_lua, index);
+    if (p != NULL)
+    {
+        if (lua_getmetatable(_lua, index))
+        {
+            // Check if it matches the type's metatable.
+            luaL_getmetatable(_lua, type);
+            if (lua_rawequal(_lua, -1, -2))
+            {
+                lua_pop(_lua, 2);
+                return p;
+            }
+            lua_pop(_lua, 1);
+
+            // Check if it matches any of the derived types' metatables.
+            const std::vector<std::string>& types = _hierarchy[type];
+            for (unsigned int i = 0, count = types.size(); i < count; i++)
+            {
+                luaL_getmetatable(_lua, types[i].c_str());
+                if (lua_rawequal(_lua, -1, -2))
+                {
+                    lua_pop(_lua, 2);
+                    return p;
+                }
+                lua_pop(_lua, 1);
+            }
+            
+            lua_pop(_lua, 1);
+        }
+    }
+    return NULL;
+}
+
+void ScriptController::loadScript(const char* path)
+{
+    if (luaL_dofile(_lua, path))
+        GP_ERROR("Failed to run Lua script with error: '%s'.", lua_tostring(_lua, -1));
+}
+
+bool ScriptController::getBool(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return luaCheckBool(_lua, -1);
+}
+
+char ScriptController::getChar(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return (char)luaL_checkint(_lua, -1);
+}
+
+short ScriptController::getShort(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return (short)luaL_checkint(_lua, -1);
+}
+
+int ScriptController::getInt(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return luaL_checkint(_lua, -1);
+}
+
+long ScriptController::getLong(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return luaL_checklong(_lua, -1);
+}
+
+unsigned char ScriptController::getUnsignedChar(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return (unsigned char)luaL_checkunsigned(_lua, -1);
+}
+
+unsigned short ScriptController::getUnsignedShort(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return (unsigned short)luaL_checkunsigned(_lua, -1);
+}
+
+unsigned int ScriptController::getUnsignedInt(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return (unsigned int)luaL_checkunsigned(_lua, -1);
+}
+
+unsigned long ScriptController::getUnsignedLong(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return (unsigned long)luaL_checkunsigned(_lua, -1);
+}
+
+float ScriptController::getFloat(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return (float)luaL_checknumber(_lua, -1);
+}
+
+double ScriptController::getDouble(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return (double)luaL_checknumber(_lua, -1);
+}
+
+const char* ScriptController::getString(const char* name)
+{
+    lua_getglobal(_lua, name);
+    return luaL_checkstring(_lua, -1);
+}
+
+void ScriptController::setBool(const char* name, bool v)
+{
+    lua_pushboolean(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::setChar(const char* name, char v)
+{
+    lua_pushinteger(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::setShort(const char* name, short v)
+{
+    lua_pushinteger(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::setInt(const char* name, int v)
+{
+    lua_pushinteger(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::setLong(const char* name, long v)
+{
+    lua_pushinteger(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::setUnsignedChar(const char* name, unsigned char v)
+{
+    lua_pushunsigned(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::setUnsignedShort(const char* name, unsigned short v)
+{
+    lua_pushunsigned(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::setUnsignedInt(const char* name, unsigned int v)
+{
+    lua_pushunsigned(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::setUnsignedLong(const char* name, unsigned long v)
+{
+    lua_pushunsigned(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::setFloat(const char* name, float v)
+{
+    lua_pushnumber(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::setDouble(const char* name, double v)
+{
+    lua_pushnumber(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::setString(const char* name, const char* v)
+{
+    lua_pushstring(_lua, v);
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::registerLibrary(const char* name, const luaL_Reg* functions)
+{
+    lua_newtable(_lua);
+
+    // Go through the list of functions and add them to the table.
+    const luaL_Reg* iter = functions;
+    for (; iter && iter->name; iter++)
+    {
+        lua_pushcfunction(_lua, iter->func);
+        lua_setfield(_lua, -2, iter->name);
+    }
+
+    lua_setglobal(_lua, name);
+}
+
+void ScriptController::registerConstantBool(std::string name, bool value, std::vector<std::string> scopePath)
+{
+    // If the constant is within a scope, get the correct parent 
+    // table on the stack before setting its value.
+    if (scopePath.size() > 0)
+    {
+        lua_getglobal(_lua, scopePath[0].c_str());
+        for (unsigned int i = 1; i < scopePath.size(); i++)
+        {
+            lua_pushstring(_lua, scopePath[i].c_str());
+            lua_gettable(_lua, -2);
+        }
+        
+        // Add the constant to the parent table.
+        lua_pushboolean(_lua, value);
+        lua_setfield(_lua, -2, name.c_str());
+
+        // Pop all the parent tables off the stack.
+        int size = scopePath.size();
+        lua_pop(_lua, size);
+    }
+    else
+    {
+        // TODO: Currently unsupported (we don't parse for this yet).
+        // If the constant is global, add it to the global table.
+        lua_pushboolean(_lua, value);
+        lua_pushvalue(_lua, -1);
+        lua_setglobal(_lua, name.c_str());
+    }
+}
+
+void ScriptController::registerConstantNumber(std::string name, double value, std::vector<std::string> scopePath)
+{
+    // If the constant is within a scope, get the correct parent 
+    // table on the stack before setting its value.
+    if (scopePath.size() > 0)
+    {
+        lua_getglobal(_lua, scopePath[0].c_str());
+        for (unsigned int i = 1; i < scopePath.size(); i++)
+        {
+            lua_pushstring(_lua, scopePath[i].c_str());
+            lua_gettable(_lua, -2);
+        }
+        
+        // Add the constant to the parent table.
+        lua_pushnumber(_lua, value);
+        lua_setfield(_lua, -2, name.c_str());
+
+        // Pop all the parent tables off the stack.
+        int size = scopePath.size();
+        lua_pop(_lua, size);
+    }
+    else
+    {
+        // TODO: Currently unsupported (we don't parse for this yet).
+        // If the constant is global, add it to the global table.
+        lua_pushnumber(_lua, value);
+        lua_pushvalue(_lua, -1);
+        lua_setglobal(_lua, name.c_str());
+    }
+}
+
+void ScriptController::registerConstantString(std::string name, std::string value, std::vector<std::string> scopePath)
+{
+    // If the constant is within a scope, get the correct parent 
+    // table on the stack before setting its value.
+    if (scopePath.size() > 0)
+    {
+        lua_getglobal(_lua, scopePath[0].c_str());
+        for (unsigned int i = 1; i < scopePath.size(); i++)
+        {
+            lua_pushstring(_lua, scopePath[i].c_str());
+            lua_gettable(_lua, -2);
+        }
+        
+        // Add the constant to the parent table.
+        lua_pushstring(_lua, value.c_str());
+        lua_setfield(_lua, -2, name.c_str());
+
+        // Pop all the parent tables off the stack.
+        int size = scopePath.size();
+        lua_pop(_lua, size);
+    }
+    else
+    {
+        // TODO: Currently unsupported (we don't parse for this yet).
+        // If the constant is global, add it to the global table.
+        lua_pushstring(_lua, value.c_str());
+        lua_pushvalue(_lua, -1);
+        lua_setglobal(_lua, name.c_str());
+    }
+}
+
+void ScriptController::registerClass(const char* name, const luaL_Reg* members, lua_CFunction newFunction, 
+    lua_CFunction deleteFunction, const luaL_Reg* statics,  std::vector<std::string> scopePath)
+{
+    // If the type is an inner type, get the correct parent 
+    // table on the stack before creating the table for the class.
+    if (scopePath.size() > 0)
+    {
+        std::string tablename = name;
+
+        // Strip off the scope path part of the name.
+        lua_getglobal(_lua, scopePath[0].c_str());
+        std::size_t index = tablename.find(scopePath[0]);
+        if (index != tablename.npos)
+            tablename = tablename.substr(index + scopePath[0].size());
+        
+        for (unsigned int i = 1; i < scopePath.size(); i++)
+        {
+            lua_pushstring(_lua, scopePath[i].c_str());
+            lua_gettable(_lua, -2);
+
+            index = tablename.find(scopePath[i]);
+            if (index != tablename.npos)
+                tablename = tablename.substr(index + scopePath[i].size());
+        }
+
+        lua_pushstring(_lua, tablename.c_str());
+        lua_newtable(_lua);
+    }
+    else
+    {
+        // If the type is not an inner type, set it as a global table.
+        lua_newtable(_lua);
+        lua_pushvalue(_lua, -1);
+        lua_setglobal(_lua, name);
+    }
+    
+    // Create the metatable and populate it with the member functions.
+    lua_pushliteral(_lua, "__metatable");
+    luaL_newmetatable(_lua, name);
+    if (members)
+        luaL_setfuncs(_lua, members, 0);
+    lua_pushstring(_lua, "__index");
+    lua_pushvalue(_lua, -2);
+    lua_settable(_lua, -3);
+
+    // Add the delete function if it was specified.
+    if (deleteFunction)
+    {
+        lua_pushstring(_lua, "__gc");
+        lua_pushcfunction(_lua, deleteFunction);
+        lua_settable(_lua, -3);
+    }
+
+    // Set the metatable on the main table.
+    lua_settable(_lua, -3);
+    
+    // Populate the main table with the static functions.
+    if (statics)
+        luaL_setfuncs(_lua, statics, 0);
+
+    // Set the new function(s) for the class.
+    if (newFunction)
+    {
+        lua_pushliteral(_lua, "new");
+        lua_pushcfunction(_lua, newFunction);
+        lua_settable(_lua, -3);
+    }
+
+    // Set the table we just created within the correct parent table.
+    if (scopePath.size() > 0)
+    {
+        lua_settable(_lua, -3);
+
+        // Pop all the parent tables off the stack.
+        int size = scopePath.size();
+        lua_pop(_lua, size);
+    }
+    else
+    {
+        // Pop the main table off the stack.
+        lua_pop(_lua, 1);
+    }
+}
+
+void ScriptController::registerFunction(const char* luaFunction, lua_CFunction cppFunction)
+{
+    lua_pushcfunction(_lua, cppFunction);
+    lua_setglobal(_lua, luaFunction);
+}
+
+void ScriptController::setGlobalHierarchy(std::map<std::string, std::vector<std::string> > hierarchy)
+{
+    _hierarchy = hierarchy;
+}
+
+ScriptController::ScriptController()
+{
+    memset(_callbacks, 0, sizeof(std::string*) * CALLBACK_COUNT);
+    __instance = this;
+}
+
+ScriptController::~ScriptController()
+{
+    __instance = NULL;
+}
+
+void ScriptController::initialize()
+{
+    _lua = luaL_newstate();
+    if (!_lua)
+        GP_ERROR("Failed to initialize Lua scripting engine.");
+    luaL_openlibs(_lua);
+    lua_RegisterAllBindings();
+}
+
+void ScriptController::initializeGame()
+{
+    if (_callbacks[INITIALIZE])
+    {
+        executeFunction<void>(_callbacks[INITIALIZE]->c_str(), NULL);
+    }
+}
+
+void ScriptController::finalize()
+{
+    lua_close(_lua);
+}
+
+void ScriptController::finalizeGame()
+{
+    if (_callbacks[FINALIZE])
+    {
+        executeFunction<void>(_callbacks[FINALIZE]->c_str(), NULL);
+    }
+}
+
+void ScriptController::update(long elapsedTime)
+{
+    if (_callbacks[UPDATE])
+    {
+        executeFunction<void>(_callbacks[UPDATE]->c_str(), "l", elapsedTime);
+    }
+}
+
+void ScriptController::render(long elapsedTime)
+{
+    if (_callbacks[RENDER])
+    {
+        executeFunction<void>(_callbacks[RENDER]->c_str(), "l", elapsedTime);
+    }
+}
+
+void ScriptController::executeFunctionHelper(int resultCount, const char* func, const char* args, va_list& list)
+{
+    const char* sig = args;
+
+    int argumentCount = 0;
+    lua_getglobal(_lua, func);
+
+    // Push the arguments to the Lua stack if there are any.
+    if (sig)
+    {
+        while (true)
+        {
+            if (!(*sig))
+                break;
+
+            switch(*sig++)
+            {
+            // Signed integers.
+            case 'c':
+            case 'h':
+            case 'i':
+            case 'l':
+                lua_pushinteger(_lua, va_arg(list, int));
+                break;
+            // Unsigned integers.
+            case 'u':
+                // Skip past the actual type (long, int, short, char).
+                sig++;
+                lua_pushunsigned(_lua, va_arg(list, int));
+                break;
+            // Booleans.
+            case 'b':
+                lua_pushboolean(_lua, va_arg(list, int));
+                break;
+            // Floating point numbers.
+            case 'f':
+            case 'd':
+                lua_pushnumber(_lua, va_arg(list, double));
+                break;
+            // Strings.
+            case 's':
+                lua_pushstring(_lua, va_arg(list, char*));
+                break;
+            // Pointers.
+            case 'p':
+                lua_pushlightuserdata(_lua, va_arg(list, void*));
+                break;
+            default:
+                GP_ERROR("Invalid argument type '%d'.", *(sig - 1));
+            }
+
+            argumentCount++;
+            luaL_checkstack(_lua, 1, "Too many arguments.");
+        }
+    }
+
+    // Perform the function call.
+    if (lua_pcall(_lua, argumentCount, resultCount, 0) != 0)
+        GP_ERROR("Failed to call function '%s' with error '%s'.", func, lua_tostring(_lua, -1));
+}
+
+void ScriptController::registerCallback(ScriptCallback callback, std::string function)
+{
+    SAFE_DELETE(_callbacks[callback]);
+    _callbacks[callback] = new std::string(function);
+}
+
+}

+ 616 - 0
gameplay/src/ScriptController.h

@@ -0,0 +1,616 @@
+#ifndef SCRIPTCONTROLLER_H
+#define SCRIPTCONTROLLER_H
+
+#include "Base.h"
+
+namespace gameplay
+{
+
+/**
+ * Controls and manages all scripts.
+ */
+class ScriptController
+{
+    friend class Game;
+
+public:
+
+    /**
+     * Represents a C++ object from within Lua.
+     * @script{ignore}
+     */
+    struct LuaObject
+    {
+        /** The actual object instance. */
+        void* instance;
+        /** Whether object is owned by Lua. */
+        bool owns;
+    };
+
+    /**
+     * Calls the specifed Lua function using the given parameters.
+     * 
+     * @param func The name of the function to call.
+     * @param args The argument signature of the function. Of the form 'xxx', where each 'x' is a parameter type and must be one of:
+     *      - 'b' - bool
+     *      - 'c' - char
+     *      - 'h' - short
+     *      - 'i' - int
+     *      - 'l' - long
+     *      - 'f' - float
+     *      - 'd' - double
+     *      - 'ui' - unsigned int
+     *      - 'ul' - unsigned long
+     *      - 'uc' - unsigned char
+     *      - 'uh' - unsigned short
+     *      - 's' - string
+     *      - 'p' - pointer
+     * @return The return value of the executed Lua function.
+     * @script{ignore}
+     */
+    template<typename T> T executeFunction(const char* func, const char* args, ...);
+
+    // Template specializations.
+    template<> void executeFunction<void>(const char* func, const char* args, ...);
+    template<> bool executeFunction<bool>(const char* func, const char* args, ...);
+    template<> char executeFunction<char>(const char* func, const char* args, ...);
+    template<> short executeFunction<short>(const char* func, const char* args, ...);
+    template<> int executeFunction<int>(const char* func, const char* args, ...);
+    template<> long executeFunction<long>(const char* func, const char* args, ...);
+    template<> unsigned char executeFunction<unsigned char>(const char* func, const char* args, ...);
+    template<> unsigned short executeFunction<unsigned short>(const char* func, const char* args, ...);
+    template<> unsigned int executeFunction<unsigned int>(const char* func, const char* args, ...);
+    template<> unsigned long executeFunction<unsigned long>(const char* func, const char* args, ...);
+    template<> float executeFunction<float>(const char* func, const char* args, ...);
+    template<> double executeFunction<double>(const char* func, const char* args, ...);
+    template<> std::string executeFunction<std::string>(const char* func, const char* args, ...);
+
+    /**
+     * Used to specify the pointer type for executing Lua functions that return pointers.
+     * @script{ignore}
+     */
+    struct Type
+    {
+        explicit Type(const char* type) : type(type) {}
+        const char* type;
+    };
+
+    /**
+     * Calls the specifed Lua function using the given parameters.
+     * 
+     * @param type The class of the return value pointer.
+     * @param func The name of the function to call.
+     * @param args The argument signature of the function. Of the form 'xxx', where each 'x' is a parameter type and must be one of:
+     *      - 'b' - bool
+     *      - 'c' - char
+     *      - 'h' - short
+     *      - 'i' - int
+     *      - 'l' - long
+     *      - 'f' - float
+     *      - 'd' - double
+     *      - 'ui' - unsigned int
+     *      - 'ul' - unsigned long
+     *      - 'uc' - unsigned char
+     *      - 'uh' - unsigned short
+     *      - 's' - string
+     *      - 'p' - pointer
+     * @return The return value of the executed Lua function.
+     * @script{ignore}
+     */
+    template<typename T> T* executeFunction(const Type& type, const char* func, const char* args, ...);
+
+    /**
+     * Gets the global instance of the script controller.
+     * 
+     * @return The global instance of the script controller (NULL if it hasn't yet been created).
+     */
+    static ScriptController* getInstance();
+
+    /**
+     * Loads the given script file and executes its global code.
+     * 
+     * @param path The path to the script.
+     */
+    void loadScript(const char* path);
+
+    /**
+     * Gets a pointer to a bool (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.
+     * 
+     * @param index The stack index.
+     * @return The pointer.
+     */
+    bool* getBoolPointer(int index);
+
+    /**
+     * Gets a pointer to a short (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.
+     * 
+     * @param index The stack index.
+     * @return The pointer.
+     */
+    short* getShortPointer(int index);
+
+    /**
+     * Gets a pointer to an int (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.
+     * 
+     * @param index The stack index.
+     * @return The pointer.
+     */
+    int* getIntPointer(int index);
+
+    /**
+     * Gets a pointer to a long (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.
+     * 
+     * @param index The stack index.
+     * @return The pointer.
+     */
+    long* getLongPointer(int index);
+
+    /**
+     * Gets a pointer to an unsigned char (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.
+     * 
+     * @param index The stack index.
+     * @return The pointer.
+     */
+    unsigned char* getUnsignedCharPointer(int index);
+
+    /**
+     * Gets a pointer to an unsigned short (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.
+     * 
+     * @param index The stack index.
+     * @return The pointer.
+     */
+    unsigned short* getUnsignedShortPointer(int index);
+
+    /**
+     * Gets a pointer to an unsigned int (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.
+     * 
+     * @param index The stack index.
+     * @return The pointer.
+     */
+    unsigned int* getUnsignedIntPointer(int index);
+
+    /**
+     * Gets a pointer to an unsigned long (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.
+     * 
+     * @param index The stack index.
+     * @return The pointer.
+     */
+    unsigned long* getUnsignedLongPointer(int index);
+
+    /**
+     * Gets a pointer to a float (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.
+     * 
+     * @param index The stack index.
+     * @return The pointer.
+     */
+    float* getFloatPointer(int index);
+
+    /**
+     * Gets a pointer to a double (as an array-use SAFE_DELETE_ARRAY to clean up) for the given stack index.
+     * 
+     * @param index The stack index.
+     * @return The pointer.
+     */
+    double* getDoublePointer(int index);
+
+    /**
+     * Gets an object pointer of the given type for the given stack index.
+     * 
+     * @param type The type of object pointer to retrieve.
+     * @param index The stack index.
+     * @return The object pointer or <code>NULL</code> if the data at the stack index
+     *      is not an object or if the object is not derived from the given type.
+     * @script{ignore}
+     */
+    void* getObjectPointer(int index, const char* type);
+
+    /**
+     * Gets the global boolean variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global boolean variable.
+     * @script{ignore}
+     */
+    bool getBool(const char* name);
+
+    /**
+     * Gets the global char variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global char variable.
+     * @script{ignore}
+     */
+    char getChar(const char* name);
+
+    /**
+     * Gets the global short variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global short variable.
+     * @script{ignore}
+     */
+    short getShort(const char* name);
+
+    /**
+     * Gets the global int variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global int variable.
+     * @script{ignore}
+     */
+    int getInt(const char* name);
+
+    /**
+     * Gets the global long variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global long variable.
+     * @script{ignore}
+     */
+    long getLong(const char* name);
+
+    /**
+     * Gets the global unsigned char variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global unsigned char variable.
+     * @script{ignore}
+     */
+    unsigned char getUnsignedChar(const char* name);
+
+    /**
+     * Gets the global unsigned short variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global unsigned short variable.
+     * @script{ignore}
+     */
+    unsigned short getUnsignedShort(const char* name);
+
+    /**
+     * Gets the global unsigned int variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global unsigned int variable.
+     * @script{ignore}
+     */
+    unsigned int getUnsignedInt(const char* name);
+
+    /**
+     * Gets the global unsigned long variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global unsigned long variable.
+     * @script{ignore}
+     */
+    unsigned long getUnsignedLong(const char* name);
+
+    /**
+     * Gets the global float variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global float variable.
+     * @script{ignore}
+     */
+    float getFloat(const char* name);
+
+    /**
+     * Gets the global double variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global double variable.
+     * @script{ignore}
+     */
+    double getDouble(const char* name);
+
+    /**
+     * Gets the global string variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @return The global string variable.
+     * @script{ignore}
+     */
+    const char* getString(const char* name);
+
+    /**
+     * Gets the global pointer variable of the given type with the given name.
+     * 
+     * @param type The type of the variable in Lua.
+     * @param name The name of the variable.
+     * @return The global pointer variable.
+     * @script{ignore}
+     */
+    template<typename T>T* getPointer(const char* type, const char* name);
+
+    /**
+     * Sets the global boolean variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The boolean variable.
+     * @script{ignore}
+     */
+    void setBool(const char* name, bool v);
+
+    /**
+     * Sets the global char variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The char variable.
+     * @script{ignore}
+     */
+    void setChar(const char* name, char v);
+
+    /**
+     * Sets the global short variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The short variable.
+     * @script{ignore}
+     */
+    void setShort(const char* name, short v);
+
+    /**
+     * Sets the global int variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The int variable.
+     * @script{ignore}
+     */
+    void setInt(const char* name, int v);
+
+    /**
+     * Sets the global long variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The long variable.
+     * @script{ignore}
+     */
+    void setLong(const char* name, long v);
+
+    /**
+     * Gets the global unsigned char variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The unsigned char variable.
+     * @script{ignore}
+     */
+    void setUnsignedChar(const char* name, unsigned char v);
+
+    /**
+     * Sets the global unsigned short variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The unsigned short variable.
+     * @script{ignore}
+     */
+    void setUnsignedShort(const char* name, unsigned short v);
+
+    /**
+     * Sets the global unsigned int variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The unsigned int variable.
+     * @script{ignore}
+     */
+    void setUnsignedInt(const char* name, unsigned int v);
+
+    /**
+     * Sets the global unsigned long variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The unsigned long variable.
+     * @script{ignore}
+     */
+    void setUnsignedLong(const char* name, unsigned long v);
+
+    /**
+     * Sets the global float variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The float variable.
+     * @script{ignore}
+     */
+    void setFloat(const char* name, float v);
+
+    /**
+     * Sets the global double variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The double variable.
+     * @script{ignore}
+     */
+    void setDouble(const char* name, double v);
+
+    /**
+     * Sets the global string variable with the given name.
+     * 
+     * @param name The name of the variable.
+     * @param v The string variable.
+     * @script{ignore}
+     */
+    void setString(const char* name, const char* v);
+
+    /**
+     * Sets the global pointer variable of the given type with the given name.
+     * 
+     * @param type The type of the variable in Lua.
+     * @param name The name of the variable.
+     * @param v The pointer variable.
+     * @script{ignore}
+     */
+    template<typename T>void setPointer(const char* type, const char* name, T* v);
+
+    /**
+     * Registers the given library with Lua.
+     * 
+     * @param name The name of the library from within Lua.
+     * @param function The library function mapping (Lua function names to C++ functions).
+     * @script{ignore}
+     */
+    void registerLibrary(const char* name, const luaL_Reg* functions);
+
+    /**
+     * Registers the given boolean constant as valid for the given scope path.
+     * 
+     * @param name The name of the constant (what the user would use from Lua).
+     * @param value The constant's value.
+     * @param scopePath The list of containing classes, going inward from the most outer class.
+     * @script{ignore}
+     */
+    void registerConstantBool(std::string name, bool value, std::vector<std::string> scopePath);
+
+    /**
+     * Registers the given number constant as valid for the given scope path.
+     * 
+     * @param name The name of the constant (what the user would use from Lua).
+     * @param value The constant's value.
+     * @param scopePath The list of containing classes, going inward from the most outer class.
+     * @script{ignore}
+     */
+    void registerConstantNumber(std::string name, double value, std::vector<std::string> scopePath);
+
+    /**
+     * Registers the given string constant as valid for the given scope path.
+     * 
+     * @param name The name of the constant (what the user would use from Lua).
+     * @param value The constant's value.
+     * @param scopePath The list of containing classes, going inward from the most outer class.
+     * @script{ignore}
+     */
+    void registerConstantString(std::string name, std::string value, std::vector<std::string> scopePath);
+
+    /**
+     * Registers the given class type with Lua.
+     * 
+     * @param name The name of the class from within Lua.
+     * @param members The library function mapping for all the member functions (Lua function names to C++ functions).
+     * @param newFunction The function to call that creates an instance of the class.
+     * @param deleteFunction The function to call that destroys an instance of the class.
+     * @param statics The library function mapping for all the static functions (Lua function names to C++ functions).
+     * @param scopePath For an inner class, this is a list of its containing classes, going inward from the most outer class.
+     * @script{ignore}
+     */
+    void registerClass(const char* name, const luaL_Reg* members, lua_CFunction newFunction, lua_CFunction deleteFunction, const luaL_Reg* statics,
+        std::vector<std::string> scopePath = std::vector<std::string>());
+
+    /**
+     * Register a function with Lua.
+     * 
+     * @param luaFunction The name of the function from within Lua.
+     * @param cppFunction The C++ function pointer.
+     * @script{ignore}
+     */
+    void registerFunction(const char* luaFunction, lua_CFunction cppFunction);
+
+    /**
+     * Sets the global inheritance hierarchy.
+     * 
+     * @param hierarchy The inheritance hierarchy stored as a map of class names
+     *      to a list of all derived class names.
+     * @script{ignore}
+     */
+    void setGlobalHierarchy(std::map<std::string, std::vector<std::string> > hierarchy);
+
+private:
+
+    /**
+     * Represents a Lua callback function binding.
+     */
+    enum ScriptCallback
+    {
+        INITIALIZE = 0,
+        UPDATE,
+        RENDER,
+        FINALIZE,
+        CALLBACK_COUNT
+    };
+
+    /**
+     * Constructor.
+     */
+    ScriptController();
+
+    /**
+     * Copy constructor.
+     */
+    ScriptController(const ScriptController& copy);
+
+    /**
+     * Destructor.
+     */
+    ~ScriptController();
+
+    /**
+     * Callback for when the controller is initialized.
+     */
+    void initialize();
+
+    /**
+     * Initializes the game using the appropriate callback script (if it was specified).
+     */
+    void initializeGame();
+
+    /*
+     * Callback for when the controller is finalized.
+     */
+    void finalize();
+
+    /**
+     * Finalizes the game using the appropriate callback script (if it was specified).
+     */
+    void finalizeGame();
+    
+    /**
+     * Callback for when the controller receives a frame update event.
+     */
+    void update(long elapsedTime);
+
+    /**
+     * Renders the game using the appropriate callback script (if it was specified).
+     */
+    void render(long elapsedTime);
+
+    /**
+     * Calls the specifed Lua function using the given parameters.
+     * 
+     * @param resultCount The expected number of returned values.
+     * @param func The name of the function to call.
+     * @param args The argument signature of the function, as a string of the form
+     *      'xxx', where each 'x' is a parameter type and must be one of:
+     *      - 'b' - bool
+     *      - 'c' - char
+     *      - 'h' - short
+     *      - 'i' - int
+     *      - 'l' - long
+     *      - 'f' - float
+     *      - 'd' - double
+     *      - 'ui' - unsigned int
+     *      - 'ul' - unsigned long
+     *      - 'uc' - unsigned char
+     *      - 'uh' - unsigned short
+     *      - 's' - string
+     *      - 'p' - pointer
+     * @param list The variable argument list.
+     */
+    void executeFunctionHelper(int resultCount, const char* func, const char* args, va_list& list);
+
+    /**
+     * Registers the given script callback.
+     * 
+     * @param callback The script callback to register for.
+     * @param function The name of the function within the Lua script to call.
+     */
+    void registerCallback(ScriptCallback callback, std::string function);
+
+    lua_State* _lua;
+    unsigned int _returnCount;
+    std::map<std::string, std::vector<std::string> > _hierarchy;
+    static ScriptController* __instance;
+    std::string* _callbacks[CALLBACK_COUNT];
+};
+
+}
+
+#include "ScriptController.inl"
+
+#endif

+ 127 - 0
gameplay/src/ScriptController.inl

@@ -0,0 +1,127 @@
+#include "ScriptController.h"
+
+namespace gameplay
+{
+
+// Helper macros.
+#define SCRIPT_EXECUTE_FUNCTION_PARAM(type, checkfunc) \
+    va_list list; \
+    va_start(list, args); \
+    executeFunctionHelper(1, func, args, list); \
+    type value = (type)checkfunc(_lua, -1); \
+    lua_pop(_lua, -1); \
+    va_end(list); \
+    return value;
+
+template<typename T> T ScriptController::executeFunction(const char* func, const char* args, ...)
+{
+    GP_ERROR("Unsupported type!");
+}
+
+template<> void ScriptController::executeFunction<void>(const char* func, const char* args, ...)
+{
+    va_list list;
+    va_start(list, args);
+    executeFunctionHelper(0, func, args, list);
+    va_end(list);
+}
+
+template<> bool ScriptController::executeFunction<bool>(const char* func, const char* args, ...)
+{
+    va_list list;
+    va_start(list, args);
+    executeFunctionHelper(1, func, args, list);
+
+    bool value = (luaL_checkint(_lua, -1) != 0);
+    lua_pop(_lua, -1);
+    va_end(list);
+    return value;
+}
+
+template<> char ScriptController::executeFunction<char>(const char* func, const char* args, ...)
+{
+    SCRIPT_EXECUTE_FUNCTION_PARAM(char, luaL_checkint);
+}
+
+template<> short ScriptController::executeFunction<short>(const char* func, const char* args, ...)
+{
+    SCRIPT_EXECUTE_FUNCTION_PARAM(short, luaL_checkint);
+}
+
+template<> int ScriptController::executeFunction<int>(const char* func, const char* args, ...)
+{
+    SCRIPT_EXECUTE_FUNCTION_PARAM(int, luaL_checkint);
+}
+
+template<> long ScriptController::executeFunction<long>(const char* func, const char* args, ...)
+{
+    SCRIPT_EXECUTE_FUNCTION_PARAM(long, luaL_checklong);
+}
+
+template<> unsigned char ScriptController::executeFunction<unsigned char>(const char* func, const char* args, ...)
+{
+    SCRIPT_EXECUTE_FUNCTION_PARAM(unsigned char, luaL_checkunsigned);
+}
+
+template<> unsigned short ScriptController::executeFunction<unsigned short>(const char* func, const char* args, ...)
+{
+    SCRIPT_EXECUTE_FUNCTION_PARAM(unsigned short, luaL_checkunsigned);
+}
+
+template<> unsigned int ScriptController::executeFunction<unsigned int>(const char* func, const char* args, ...)
+{
+    SCRIPT_EXECUTE_FUNCTION_PARAM(unsigned int, luaL_checkunsigned);
+}
+
+template<> unsigned long ScriptController::executeFunction<unsigned long>(const char* func, const char* args, ...)
+{
+    SCRIPT_EXECUTE_FUNCTION_PARAM(unsigned long, luaL_checkunsigned);
+}
+
+template<> float ScriptController::executeFunction<float>(const char* func, const char* args, ...)
+{
+    SCRIPT_EXECUTE_FUNCTION_PARAM(float, luaL_checknumber);
+}
+
+template<> double ScriptController::executeFunction<double>(const char* func, const char* args, ...)
+{
+    SCRIPT_EXECUTE_FUNCTION_PARAM(double, luaL_checknumber);
+}
+
+template<> std::string ScriptController::executeFunction<std::string>(const char* func, const char* args, ...)
+{
+    SCRIPT_EXECUTE_FUNCTION_PARAM(std::string, luaL_checkstring);
+}
+
+template<typename T> T* ScriptController::executeFunction(const Type& type, const char* func, const char* args, ...)
+{
+    va_list list;
+    va_start(list, args);
+    executeFunctionHelper(1, func, args, list);
+
+    T* value = (T*)*((T**)luaL_checkudata(_lua, -1, type.type));
+    lua_pop(_lua, -1);
+    va_end(list);
+    return value;
+}
+
+template<typename T>T* ScriptController::getPointer(const char* type, const char* name)
+{
+    lua_getglobal(_lua, name);
+    void* userdata = luaL_checkudata(_lua, -1, type);
+    std::string msg = std::string("'") + std::string(type) + std::string("' expected.");
+    luaL_argcheck(_lua, userdata != NULL, 1, msg.c_str());
+    return (T*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+template<typename T>void ScriptController::setPointer(const char* type, const char* name, T* v)
+{
+    ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+    object->instance = (void*)v;
+    object->owns = false;
+    luaL_getmetatable(state, type);
+    lua_setmetatable(state, -2);
+    lua_setglobal(_lua, name);
+}
+
+}

+ 1 - 1
gameplay/src/Texture.cpp

@@ -180,7 +180,7 @@ Texture* Texture::create(Format format, unsigned int width, unsigned int height,
 }
 
 // Computes the size of a PVRTC data chunk for a mipmap level of the given size.
-unsigned int computePVRTCDataSize(int width, int height, int bpp)
+static unsigned int computePVRTCDataSize(int width, int height, int bpp)
 {
     int blockSize;
     int widthBlocks;

+ 1 - 0
gameplay/src/TimeListener.h

@@ -6,6 +6,7 @@ namespace gameplay
 
 /**
  * The TimeListener interface allows a class to be scheduled and called at a later time using Game::schedule().
+ * @script{ignore}
  */
 class TimeListener
 {

+ 1 - 0
gameplay/src/VertexAttributeBinding.h

@@ -63,6 +63,7 @@ public:
      * @param effect The effect.
      * 
      * @return A VertexAttributeBinding for the requested parameters.
+     * @script{ignore}
      */
     static VertexAttributeBinding* create(const VertexFormat& vertexFormat, void* vertexPointer, Effect* effect);
 

+ 5 - 0
gameplay/src/VerticalLayout.cpp

@@ -34,6 +34,11 @@ void VerticalLayout::setBottomToTop(bool bottomToTop)
     _bottomToTop = bottomToTop;
 }
 
+bool VerticalLayout::getBottomToTop()
+{
+    return _bottomToTop;
+}
+
 Layout::Type VerticalLayout::getType()
 {
     return Layout::LAYOUT_VERTICAL;

+ 217 - 0
gameplay/src/lua/lua_AbsoluteLayout.cpp

@@ -0,0 +1,217 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "AbsoluteLayout.h"
+#include "lua_AbsoluteLayout.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_AbsoluteLayout()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"addRef", lua_AbsoluteLayout_addRef},
+        {"getRefCount", lua_AbsoluteLayout_getRefCount},
+        {"getType", lua_AbsoluteLayout_getType},
+        {"release", lua_AbsoluteLayout_release},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("AbsoluteLayout", lua_members, NULL, lua_AbsoluteLayout__gc, lua_statics, scopePath);
+}
+
+static AbsoluteLayout* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AbsoluteLayout");
+    luaL_argcheck(state, userdata != NULL, 1, "'AbsoluteLayout' expected.");
+    return (AbsoluteLayout*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_AbsoluteLayout__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, "AbsoluteLayout");
+                luaL_argcheck(state, userdata != NULL, 1, "'AbsoluteLayout' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    AbsoluteLayout* instance = (AbsoluteLayout*)object->instance;
+                    SAFE_RELEASE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AbsoluteLayout_addRef(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)
+            {
+                AbsoluteLayout* instance = getInstance(state);
+                instance->addRef();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AbsoluteLayout_getRefCount(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)
+            {
+                AbsoluteLayout* instance = getInstance(state);
+                unsigned int result = instance->getRefCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AbsoluteLayout_getType(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)
+            {
+                AbsoluteLayout* instance = getInstance(state);
+                Layout::Type result = instance->getType();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_LayoutType(result).c_str());
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AbsoluteLayout_release(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)
+            {
+                AbsoluteLayout* instance = getInstance(state);
+                instance->release();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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;
+}
+
+}

+ 18 - 0
gameplay/src/lua/lua_AbsoluteLayout.h

@@ -0,0 +1,18 @@
+#ifndef LUA_ABSOLUTELAYOUT_H_
+#define LUA_ABSOLUTELAYOUT_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AbsoluteLayout.
+int lua_AbsoluteLayout__gc(lua_State* state);
+int lua_AbsoluteLayout_addRef(lua_State* state);
+int lua_AbsoluteLayout_getRefCount(lua_State* state);
+int lua_AbsoluteLayout_getType(lua_State* state);
+int lua_AbsoluteLayout_release(lua_State* state);
+
+void luaRegister_AbsoluteLayout();
+
+}
+
+#endif

+ 674 - 0
gameplay/src/lua/lua_Animation.cpp

@@ -0,0 +1,674 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "Animation.h"
+#include "lua_Animation.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_Animation()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"addRef", lua_Animation_addRef},
+        {"createClip", lua_Animation_createClip},
+        {"createClips", lua_Animation_createClips},
+        {"getClip", lua_Animation_getClip},
+        {"getClipCount", lua_Animation_getClipCount},
+        {"getDuration", lua_Animation_getDuration},
+        {"getId", lua_Animation_getId},
+        {"getRefCount", lua_Animation_getRefCount},
+        {"pause", lua_Animation_pause},
+        {"play", lua_Animation_play},
+        {"release", lua_Animation_release},
+        {"stop", lua_Animation_stop},
+        {"targets", lua_Animation_targets},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("Animation", lua_members, NULL, lua_Animation__gc, lua_statics, scopePath);
+}
+
+static Animation* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "Animation");
+    luaL_argcheck(state, userdata != NULL, 1, "'Animation' expected.");
+    return (Animation*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_Animation__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, "Animation");
+                luaL_argcheck(state, userdata != NULL, 1, "'Animation' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    Animation* instance = (Animation*)object->instance;
+                    SAFE_RELEASE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Animation_addRef(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)
+            {
+                Animation* instance = getInstance(state);
+                instance->addRef();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Animation_createClip(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 4:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
+
+                // Get parameter 3 off the stack.
+                unsigned long param3 = (unsigned long)luaL_checkunsigned(state, 4);
+
+                Animation* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createClip(param1, param2, param3);
+                object->owns = false;
+                luaL_getmetatable(state, "AnimationClip");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Animation_createClips(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Animation* instance = getInstance(state);
+                instance->createClips(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Animation_getClip(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)
+            {
+                Animation* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getClip();
+                object->owns = false;
+                luaL_getmetatable(state, "AnimationClip");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Animation* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getClip(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "AnimationClip");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                Animation* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getClip(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "AnimationClip");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Animation_getClipCount(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)
+            {
+                Animation* instance = getInstance(state);
+                unsigned int result = instance->getClipCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Animation_getDuration(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)
+            {
+                Animation* instance = getInstance(state);
+                unsigned long result = instance->getDuration();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Animation_getId(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)
+            {
+                Animation* instance = getInstance(state);
+                const char* result = instance->getId();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Animation_getRefCount(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)
+            {
+                Animation* instance = getInstance(state);
+                unsigned int result = instance->getRefCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Animation_pause(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)
+            {
+                Animation* instance = getInstance(state);
+                instance->pause();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Animation* instance = getInstance(state);
+                instance->pause(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Animation_play(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)
+            {
+                Animation* instance = getInstance(state);
+                instance->play();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Animation* instance = getInstance(state);
+                instance->play(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Animation_release(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)
+            {
+                Animation* instance = getInstance(state);
+                instance->release();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Animation_stop(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)
+            {
+                Animation* instance = getInstance(state);
+                instance->stop();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Animation* instance = getInstance(state);
+                instance->stop(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Animation_targets(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "AnimationTarget");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationTarget' for parameter 2.");
+                    lua_error(state);
+                }
+                AnimationTarget* param1 = (AnimationTarget*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                Animation* instance = getInstance(state);
+                bool result = instance->targets(param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+}

+ 27 - 0
gameplay/src/lua/lua_Animation.h

@@ -0,0 +1,27 @@
+#ifndef LUA_ANIMATION_H_
+#define LUA_ANIMATION_H_
+
+namespace gameplay
+{
+
+// Lua bindings for Animation.
+int lua_Animation__gc(lua_State* state);
+int lua_Animation_addRef(lua_State* state);
+int lua_Animation_createClip(lua_State* state);
+int lua_Animation_createClips(lua_State* state);
+int lua_Animation_getClip(lua_State* state);
+int lua_Animation_getClipCount(lua_State* state);
+int lua_Animation_getDuration(lua_State* state);
+int lua_Animation_getId(lua_State* state);
+int lua_Animation_getRefCount(lua_State* state);
+int lua_Animation_pause(lua_State* state);
+int lua_Animation_play(lua_State* state);
+int lua_Animation_release(lua_State* state);
+int lua_Animation_stop(lua_State* state);
+int lua_Animation_targets(lua_State* state);
+
+void luaRegister_Animation();
+
+}
+
+#endif

+ 1068 - 0
gameplay/src/lua/lua_AnimationClip.cpp

@@ -0,0 +1,1068 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "AnimationClip.h"
+#include "lua_AnimationClip.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_AnimationClip()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"addBeginListener", lua_AnimationClip_addBeginListener},
+        {"addEndListener", lua_AnimationClip_addEndListener},
+        {"addListener", lua_AnimationClip_addListener},
+        {"addRef", lua_AnimationClip_addRef},
+        {"crossFade", lua_AnimationClip_crossFade},
+        {"getActiveDuration", lua_AnimationClip_getActiveDuration},
+        {"getAnimation", lua_AnimationClip_getAnimation},
+        {"getBlendWeight", lua_AnimationClip_getBlendWeight},
+        {"getDuration", lua_AnimationClip_getDuration},
+        {"getElaspedTime", lua_AnimationClip_getElaspedTime},
+        {"getEndTime", lua_AnimationClip_getEndTime},
+        {"getID", lua_AnimationClip_getID},
+        {"getRefCount", lua_AnimationClip_getRefCount},
+        {"getRepeatCount", lua_AnimationClip_getRepeatCount},
+        {"getSpeed", lua_AnimationClip_getSpeed},
+        {"getStartTime", lua_AnimationClip_getStartTime},
+        {"isPlaying", lua_AnimationClip_isPlaying},
+        {"pause", lua_AnimationClip_pause},
+        {"play", lua_AnimationClip_play},
+        {"release", lua_AnimationClip_release},
+        {"setActiveDuration", lua_AnimationClip_setActiveDuration},
+        {"setBlendWeight", lua_AnimationClip_setBlendWeight},
+        {"setRepeatCount", lua_AnimationClip_setRepeatCount},
+        {"setSpeed", lua_AnimationClip_setSpeed},
+        {"stop", lua_AnimationClip_stop},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"REPEAT_INDEFINITE", lua_AnimationClip_static_REPEAT_INDEFINITE},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("AnimationClip", lua_members, NULL, lua_AnimationClip__gc, lua_statics, scopePath);
+}
+
+static AnimationClip* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AnimationClip");
+    luaL_argcheck(state, userdata != NULL, 1, "'AnimationClip' expected.");
+    return (AnimationClip*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_AnimationClip__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, "AnimationClip");
+                luaL_argcheck(state, userdata != NULL, 1, "'AnimationClip' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    AnimationClip* instance = (AnimationClip*)object->instance;
+                    SAFE_RELEASE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_addBeginListener(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "AnimationClipListener");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationClip::Listener' for parameter 2.");
+                    lua_error(state);
+                }
+                AnimationClip::Listener* param1 = (AnimationClip::Listener*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                AnimationClip* instance = getInstance(state);
+                instance->addBeginListener(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationClip_addEndListener(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "AnimationClipListener");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationClip::Listener' for parameter 2.");
+                    lua_error(state);
+                }
+                AnimationClip::Listener* param1 = (AnimationClip::Listener*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                AnimationClip* instance = getInstance(state);
+                instance->addEndListener(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationClip_addListener(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_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "AnimationClipListener");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationClip::Listener' for parameter 2.");
+                    lua_error(state);
+                }
+                AnimationClip::Listener* param1 = (AnimationClip::Listener*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
+
+                AnimationClip* instance = getInstance(state);
+                instance->addListener(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_addRef(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                instance->addRef();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_crossFade(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_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "AnimationClip");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationClip' for parameter 2.");
+                    lua_error(state);
+                }
+                AnimationClip* param1 = (AnimationClip*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
+
+                AnimationClip* instance = getInstance(state);
+                instance->crossFade(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_getActiveDuration(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                unsigned long result = instance->getActiveDuration();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_getAnimation(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getAnimation();
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_getBlendWeight(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                float result = instance->getBlendWeight();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_getDuration(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                unsigned long result = instance->getDuration();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_getElaspedTime(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                unsigned long result = instance->getElaspedTime();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_getEndTime(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                unsigned long result = instance->getEndTime();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_getID(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                const char* result = instance->getID();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_getRefCount(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                unsigned int result = instance->getRefCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_getRepeatCount(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                float result = instance->getRepeatCount();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_getSpeed(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                float result = instance->getSpeed();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_getStartTime(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                unsigned long result = instance->getStartTime();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_isPlaying(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                bool result = instance->isPlaying();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_pause(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                instance->pause();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_play(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                instance->play();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_release(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                instance->release();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClip_setActiveDuration(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned long param1 = (unsigned long)luaL_checkunsigned(state, 2);
+
+                AnimationClip* instance = getInstance(state);
+                instance->setActiveDuration(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationClip_setBlendWeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                AnimationClip* instance = getInstance(state);
+                instance->setBlendWeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationClip_setRepeatCount(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                AnimationClip* instance = getInstance(state);
+                instance->setRepeatCount(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationClip_setSpeed(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                AnimationClip* instance = getInstance(state);
+                instance->setSpeed(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationClip_static_REPEAT_INDEFINITE(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    unsigned int result = AnimationClip::REPEAT_INDEFINITE;
+
+    // Push the return value onto the stack.
+    lua_pushunsigned(state, result);
+
+    return 1;
+}
+
+int lua_AnimationClip_stop(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)
+            {
+                AnimationClip* instance = getInstance(state);
+                instance->stop();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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;
+}
+
+}

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

@@ -0,0 +1,40 @@
+#ifndef LUA_ANIMATIONCLIP_H_
+#define LUA_ANIMATIONCLIP_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AnimationClip.
+int lua_AnimationClip__gc(lua_State* state);
+int lua_AnimationClip_addBeginListener(lua_State* state);
+int lua_AnimationClip_addEndListener(lua_State* state);
+int lua_AnimationClip_addListener(lua_State* state);
+int lua_AnimationClip_addRef(lua_State* state);
+int lua_AnimationClip_crossFade(lua_State* state);
+int lua_AnimationClip_getActiveDuration(lua_State* state);
+int lua_AnimationClip_getAnimation(lua_State* state);
+int lua_AnimationClip_getBlendWeight(lua_State* state);
+int lua_AnimationClip_getDuration(lua_State* state);
+int lua_AnimationClip_getElaspedTime(lua_State* state);
+int lua_AnimationClip_getEndTime(lua_State* state);
+int lua_AnimationClip_getID(lua_State* state);
+int lua_AnimationClip_getRefCount(lua_State* state);
+int lua_AnimationClip_getRepeatCount(lua_State* state);
+int lua_AnimationClip_getSpeed(lua_State* state);
+int lua_AnimationClip_getStartTime(lua_State* state);
+int lua_AnimationClip_isPlaying(lua_State* state);
+int lua_AnimationClip_pause(lua_State* state);
+int lua_AnimationClip_play(lua_State* state);
+int lua_AnimationClip_release(lua_State* state);
+int lua_AnimationClip_setActiveDuration(lua_State* state);
+int lua_AnimationClip_setBlendWeight(lua_State* state);
+int lua_AnimationClip_setRepeatCount(lua_State* state);
+int lua_AnimationClip_setSpeed(lua_State* state);
+int lua_AnimationClip_static_REPEAT_INDEFINITE(lua_State* state);
+int lua_AnimationClip_stop(lua_State* state);
+
+void luaRegister_AnimationClip();
+
+}
+
+#endif

+ 121 - 0
gameplay/src/lua/lua_AnimationClipListener.cpp

@@ -0,0 +1,121 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "AnimationClip.h"
+#include "lua_AnimationClipListener.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_AnimationClipListener()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"animationEvent", lua_AnimationClipListener_animationEvent},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+    scopePath.push_back("AnimationClip");
+
+    sc->registerClass("AnimationClipListener", lua_members, NULL, lua_AnimationClipListener__gc, lua_statics, scopePath);
+}
+
+static AnimationClip::Listener* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AnimationClipListener");
+    luaL_argcheck(state, userdata != NULL, 1, "'AnimationClipListener' expected.");
+    return (AnimationClip::Listener*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_AnimationClipListener__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, "AnimationClipListener");
+                luaL_argcheck(state, userdata != NULL, 1, "'AnimationClipListener' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    AnimationClip::Listener* instance = (AnimationClip::Listener*)object->instance;
+                    SAFE_DELETE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationClipListener_animationEvent(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_TUSERDATA &&
+                lua_type(state, 3) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "AnimationClip");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationClip' for parameter 2.");
+                    lua_error(state);
+                }
+                AnimationClip* param1 = (AnimationClip*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                AnimationClip::Listener::EventType param2 = (AnimationClip::Listener::EventType)lua_enumFromString_AnimationClipListenerEventType(luaL_checkstring(state, 3));
+
+                AnimationClip::Listener* instance = getInstance(state);
+                instance->animationEvent(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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;
+}
+
+}

+ 15 - 0
gameplay/src/lua/lua_AnimationClipListener.h

@@ -0,0 +1,15 @@
+#ifndef LUA_ANIMATIONCLIPLISTENER_H_
+#define LUA_ANIMATIONCLIPLISTENER_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AnimationClip::Listener.
+int lua_AnimationClipListener__gc(lua_State* state);
+int lua_AnimationClipListener_animationEvent(lua_State* state);
+
+void luaRegister_AnimationClipListener();
+
+}
+
+#endif

+ 66 - 0
gameplay/src/lua/lua_AnimationController.cpp

@@ -0,0 +1,66 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "AnimationController.h"
+#include "lua_AnimationController.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_AnimationController()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"stopAllAnimations", lua_AnimationController_stopAllAnimations},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("AnimationController", lua_members, NULL, NULL, lua_statics, scopePath);
+}
+
+static AnimationController* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AnimationController");
+    luaL_argcheck(state, userdata != NULL, 1, "'AnimationController' expected.");
+    return (AnimationController*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_AnimationController_stopAllAnimations(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)
+            {
+                AnimationController* instance = getInstance(state);
+                instance->stopAllAnimations();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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;
+}
+
+}

+ 14 - 0
gameplay/src/lua/lua_AnimationController.h

@@ -0,0 +1,14 @@
+#ifndef LUA_ANIMATIONCONTROLLER_H_
+#define LUA_ANIMATIONCONTROLLER_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AnimationController.
+int lua_AnimationController_stopAllAnimations(lua_State* state);
+
+void luaRegister_AnimationController();
+
+}
+
+#endif

+ 617 - 0
gameplay/src/lua/lua_AnimationTarget.cpp

@@ -0,0 +1,617 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "AnimationTarget.h"
+#include "lua_AnimationTarget.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_AnimationTarget()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"createAnimation", lua_AnimationTarget_createAnimation},
+        {"createAnimationFromBy", lua_AnimationTarget_createAnimationFromBy},
+        {"createAnimationFromTo", lua_AnimationTarget_createAnimationFromTo},
+        {"destroyAnimation", lua_AnimationTarget_destroyAnimation},
+        {"getAnimation", lua_AnimationTarget_getAnimation},
+        {"getAnimationPropertyComponentCount", lua_AnimationTarget_getAnimationPropertyComponentCount},
+        {"getAnimationPropertyValue", lua_AnimationTarget_getAnimationPropertyValue},
+        {"setAnimationPropertyValue", lua_AnimationTarget_setAnimationPropertyValue},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("AnimationTarget", lua_members, NULL, NULL, lua_statics, scopePath);
+}
+
+static AnimationTarget* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AnimationTarget");
+    luaL_argcheck(state, userdata != NULL, 1, "'AnimationTarget' expected.");
+    return (AnimationTarget*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_AnimationTarget_createAnimation(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, 3) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                const char* param2 = luaL_checkstring(state, 3);
+
+                AnimationTarget* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Properties");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Properties' for parameter 3.");
+                    lua_error(state);
+                }
+                Properties* param2 = (Properties*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                AnimationTarget* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 7:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 7) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
+
+                // Get parameter 4 off the stack.
+                unsigned long* param4 = ScriptController::getInstance()->getUnsignedLongPointer(5);
+
+                // Get parameter 5 off the stack.
+                float* param5 = ScriptController::getInstance()->getFloatPointer(6);
+
+                // Get parameter 6 off the stack.
+                Curve::InterpolationType param6 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 7));
+
+                AnimationTarget* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 9:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 8) == LUA_TTABLE || lua_type(state, 8) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 9) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
+
+                // Get parameter 4 off the stack.
+                unsigned long* param4 = ScriptController::getInstance()->getUnsignedLongPointer(5);
+
+                // Get parameter 5 off the stack.
+                float* param5 = ScriptController::getInstance()->getFloatPointer(6);
+
+                // Get parameter 6 off the stack.
+                float* param6 = ScriptController::getInstance()->getFloatPointer(7);
+
+                // Get parameter 7 off the stack.
+                float* param7 = ScriptController::getInstance()->getFloatPointer(8);
+
+                // Get parameter 8 off the stack.
+                Curve::InterpolationType param8 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 9));
+
+                AnimationTarget* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6, param7, param8);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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, 7 or 9).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationTarget_createAnimationFromBy(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 7:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 6) == LUA_TSTRING &&
+                lua_type(state, 7) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                float* param3 = ScriptController::getInstance()->getFloatPointer(4);
+
+                // Get parameter 4 off the stack.
+                float* param4 = ScriptController::getInstance()->getFloatPointer(5);
+
+                // Get parameter 5 off the stack.
+                Curve::InterpolationType param5 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 6));
+
+                // Get parameter 6 off the stack.
+                unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
+
+                AnimationTarget* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimationFromBy(param1, param2, param3, param4, param5, param6);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 7).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationTarget_createAnimationFromTo(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 7:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 6) == LUA_TSTRING &&
+                lua_type(state, 7) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                float* param3 = ScriptController::getInstance()->getFloatPointer(4);
+
+                // Get parameter 4 off the stack.
+                float* param4 = ScriptController::getInstance()->getFloatPointer(5);
+
+                // Get parameter 5 off the stack.
+                Curve::InterpolationType param5 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 6));
+
+                // Get parameter 6 off the stack.
+                unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
+
+                AnimationTarget* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimationFromTo(param1, param2, param3, param4, param5, param6);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 7).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationTarget_destroyAnimation(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)
+            {
+                AnimationTarget* instance = getInstance(state);
+                instance->destroyAnimation();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                AnimationTarget* instance = getInstance(state);
+                instance->destroyAnimation(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationTarget_getAnimation(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)
+            {
+                AnimationTarget* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getAnimation();
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                AnimationTarget* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getAnimation(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationTarget_getAnimationPropertyComponentCount(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                AnimationTarget* instance = getInstance(state);
+                unsigned int result = instance->getAnimationPropertyComponentCount(param1);
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationTarget_getAnimationPropertyValue(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
+                    lua_error(state);
+                }
+                AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                AnimationTarget* instance = getInstance(state);
+                instance->getAnimationPropertyValue(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AnimationTarget_setAnimationPropertyValue(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
+                    lua_error(state);
+                }
+                AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                AnimationTarget* instance = getInstance(state);
+                instance->setAnimationPropertyValue(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 4:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TUSERDATA &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
+                    lua_error(state);
+                }
+                AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                AnimationTarget* instance = getInstance(state);
+                instance->setAnimationPropertyValue(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+}

+ 21 - 0
gameplay/src/lua/lua_AnimationTarget.h

@@ -0,0 +1,21 @@
+#ifndef LUA_ANIMATIONTARGET_H_
+#define LUA_ANIMATIONTARGET_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AnimationTarget.
+int lua_AnimationTarget_createAnimation(lua_State* state);
+int lua_AnimationTarget_createAnimationFromBy(lua_State* state);
+int lua_AnimationTarget_createAnimationFromTo(lua_State* state);
+int lua_AnimationTarget_destroyAnimation(lua_State* state);
+int lua_AnimationTarget_getAnimation(lua_State* state);
+int lua_AnimationTarget_getAnimationPropertyComponentCount(lua_State* state);
+int lua_AnimationTarget_getAnimationPropertyValue(lua_State* state);
+int lua_AnimationTarget_setAnimationPropertyValue(lua_State* state);
+
+void luaRegister_AnimationTarget();
+
+}
+
+#endif

+ 172 - 0
gameplay/src/lua/lua_AnimationValue.cpp

@@ -0,0 +1,172 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "AnimationValue.h"
+#include "lua_AnimationValue.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_AnimationValue()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"getFloat", lua_AnimationValue_getFloat},
+        {"setFloat", lua_AnimationValue_setFloat},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("AnimationValue", lua_members, NULL, NULL, lua_statics, scopePath);
+}
+
+static AnimationValue* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AnimationValue");
+    luaL_argcheck(state, userdata != NULL, 1, "'AnimationValue' expected.");
+    return (AnimationValue*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_AnimationValue_getFloat(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                AnimationValue* instance = getInstance(state);
+                float result = instance->getFloat(param1);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 4:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float* param1 = ScriptController::getInstance()->getFloatPointer(2);
+
+                // Get parameter 2 off the stack.
+                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
+
+                // Get parameter 3 off the stack.
+                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
+
+                AnimationValue* instance = getInstance(state);
+                instance->getFloat(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AnimationValue_setFloat(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                AnimationValue* instance = getInstance(state);
+                instance->setFloat(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 4:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                (lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float* param1 = ScriptController::getInstance()->getFloatPointer(2);
+
+                // Get parameter 2 off the stack.
+                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
+
+                // Get parameter 3 off the stack.
+                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
+
+                AnimationValue* instance = getInstance(state);
+                instance->setFloat(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+}

+ 15 - 0
gameplay/src/lua/lua_AnimationValue.h

@@ -0,0 +1,15 @@
+#ifndef LUA_ANIMATIONVALUE_H_
+#define LUA_ANIMATIONVALUE_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AnimationValue.
+int lua_AnimationValue_getFloat(lua_State* state);
+int lua_AnimationValue_setFloat(lua_State* state);
+
+void luaRegister_AnimationValue();
+
+}
+
+#endif

+ 179 - 0
gameplay/src/lua/lua_AudioBuffer.cpp

@@ -0,0 +1,179 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "AudioBuffer.h"
+#include "lua_AudioBuffer.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_AudioBuffer()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"addRef", lua_AudioBuffer_addRef},
+        {"getRefCount", lua_AudioBuffer_getRefCount},
+        {"release", lua_AudioBuffer_release},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("AudioBuffer", lua_members, NULL, lua_AudioBuffer__gc, lua_statics, scopePath);
+}
+
+static AudioBuffer* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AudioBuffer");
+    luaL_argcheck(state, userdata != NULL, 1, "'AudioBuffer' expected.");
+    return (AudioBuffer*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_AudioBuffer__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, "AudioBuffer");
+                luaL_argcheck(state, userdata != NULL, 1, "'AudioBuffer' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    AudioBuffer* instance = (AudioBuffer*)object->instance;
+                    SAFE_RELEASE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioBuffer_addRef(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)
+            {
+                AudioBuffer* instance = getInstance(state);
+                instance->addRef();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioBuffer_getRefCount(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)
+            {
+                AudioBuffer* instance = getInstance(state);
+                unsigned int result = instance->getRefCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioBuffer_release(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)
+            {
+                AudioBuffer* instance = getInstance(state);
+                instance->release();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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;
+}
+
+}

+ 17 - 0
gameplay/src/lua/lua_AudioBuffer.h

@@ -0,0 +1,17 @@
+#ifndef LUA_AUDIOBUFFER_H_
+#define LUA_AUDIOBUFFER_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AudioBuffer.
+int lua_AudioBuffer__gc(lua_State* state);
+int lua_AudioBuffer_addRef(lua_State* state);
+int lua_AudioBuffer_getRefCount(lua_State* state);
+int lua_AudioBuffer_release(lua_State* state);
+
+void luaRegister_AudioBuffer();
+
+}
+
+#endif

+ 71 - 0
gameplay/src/lua/lua_AudioController.cpp

@@ -0,0 +1,71 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "AudioController.h"
+#include "lua_AudioController.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_AudioController()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("AudioController", lua_members, NULL, lua_AudioController__gc, lua_statics, scopePath);
+}
+
+static AudioController* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AudioController");
+    luaL_argcheck(state, userdata != NULL, 1, "'AudioController' expected.");
+    return (AudioController*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_AudioController__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, "AudioController");
+                luaL_argcheck(state, userdata != NULL, 1, "'AudioController' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    AudioController* instance = (AudioController*)object->instance;
+                    SAFE_DELETE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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;
+}
+
+}

+ 14 - 0
gameplay/src/lua/lua_AudioController.h

@@ -0,0 +1,14 @@
+#ifndef LUA_AUDIOCONTROLLER_H_
+#define LUA_AUDIOCONTROLLER_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AudioController.
+int lua_AudioController__gc(lua_State* state);
+
+void luaRegister_AudioController();
+
+}
+
+#endif

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

@@ -0,0 +1,526 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "AudioListener.h"
+#include "lua_AudioListener.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_AudioListener()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"getCamera", lua_AudioListener_getCamera},
+        {"getGain", lua_AudioListener_getGain},
+        {"getOrientationForward", lua_AudioListener_getOrientationForward},
+        {"getOrientationUp", lua_AudioListener_getOrientationUp},
+        {"getPosition", lua_AudioListener_getPosition},
+        {"getVelocity", lua_AudioListener_getVelocity},
+        {"setCamera", lua_AudioListener_setCamera},
+        {"setGain", lua_AudioListener_setGain},
+        {"setOrientation", lua_AudioListener_setOrientation},
+        {"setPosition", lua_AudioListener_setPosition},
+        {"setVelocity", lua_AudioListener_setVelocity},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"getInstance", lua_AudioListener_static_getInstance},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("AudioListener", lua_members, NULL, NULL, lua_statics, scopePath);
+}
+
+static AudioListener* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AudioListener");
+    luaL_argcheck(state, userdata != NULL, 1, "'AudioListener' expected.");
+    return (AudioListener*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_AudioListener_getCamera(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)
+            {
+                AudioListener* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getCamera();
+                object->owns = false;
+                luaL_getmetatable(state, "Camera");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioListener_getGain(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)
+            {
+                AudioListener* instance = getInstance(state);
+                float result = instance->getGain();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioListener_getOrientationForward(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)
+            {
+                AudioListener* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getOrientationForward());
+                object->owns = false;
+                luaL_getmetatable(state, "Vector3");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioListener_getOrientationUp(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)
+            {
+                AudioListener* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getOrientationUp());
+                object->owns = false;
+                luaL_getmetatable(state, "Vector3");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioListener_getPosition(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)
+            {
+                AudioListener* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getPosition());
+                object->owns = false;
+                luaL_getmetatable(state, "Vector3");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioListener_getVelocity(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)
+            {
+                AudioListener* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getVelocity());
+                object->owns = false;
+                luaL_getmetatable(state, "Vector3");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioListener_setCamera(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Camera");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Camera' for parameter 2.");
+                    lua_error(state);
+                }
+                Camera* param1 = (Camera*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                AudioListener* instance = getInstance(state);
+                instance->setCamera(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AudioListener_setGain(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                AudioListener* instance = getInstance(state);
+                instance->setGain(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AudioListener_setOrientation(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_TUSERDATA &&
+                lua_type(state, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Vector3");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 3.");
+                    lua_error(state);
+                }
+                Vector3* param2 = (Vector3*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                AudioListener* instance = getInstance(state);
+                instance->setOrientation(*param1, *param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioListener_setPosition(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                AudioListener* instance = getInstance(state);
+                instance->setPosition(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AudioListener_setVelocity(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                AudioListener* instance = getInstance(state);
+                instance->setVelocity(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AudioListener_static_getInstance(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 0:
+        {
+            ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+            object->instance = (void*)AudioListener::getInstance();
+            object->owns = false;
+            luaL_getmetatable(state, "AudioListener");
+            lua_setmetatable(state, -2);
+
+            return 1;
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 0).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+}

+ 25 - 0
gameplay/src/lua/lua_AudioListener.h

@@ -0,0 +1,25 @@
+#ifndef LUA_AUDIOLISTENER_H_
+#define LUA_AUDIOLISTENER_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AudioListener.
+int lua_AudioListener_getCamera(lua_State* state);
+int lua_AudioListener_getGain(lua_State* state);
+int lua_AudioListener_getOrientationForward(lua_State* state);
+int lua_AudioListener_getOrientationUp(lua_State* state);
+int lua_AudioListener_getPosition(lua_State* state);
+int lua_AudioListener_getVelocity(lua_State* state);
+int lua_AudioListener_setCamera(lua_State* state);
+int lua_AudioListener_setGain(lua_State* state);
+int lua_AudioListener_setOrientation(lua_State* state);
+int lua_AudioListener_setPosition(lua_State* state);
+int lua_AudioListener_setVelocity(lua_State* state);
+int lua_AudioListener_static_getInstance(lua_State* state);
+
+void luaRegister_AudioListener();
+
+}
+
+#endif

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

@@ -0,0 +1,809 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "AudioSource.h"
+#include "lua_AudioSource.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_AudioSource()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"addRef", lua_AudioSource_addRef},
+        {"getGain", lua_AudioSource_getGain},
+        {"getNode", lua_AudioSource_getNode},
+        {"getPitch", lua_AudioSource_getPitch},
+        {"getRefCount", lua_AudioSource_getRefCount},
+        {"getState", lua_AudioSource_getState},
+        {"getVelocity", lua_AudioSource_getVelocity},
+        {"isLooped", lua_AudioSource_isLooped},
+        {"pause", lua_AudioSource_pause},
+        {"play", lua_AudioSource_play},
+        {"release", lua_AudioSource_release},
+        {"resume", lua_AudioSource_resume},
+        {"rewind", lua_AudioSource_rewind},
+        {"setGain", lua_AudioSource_setGain},
+        {"setLooped", lua_AudioSource_setLooped},
+        {"setPitch", lua_AudioSource_setPitch},
+        {"setVelocity", lua_AudioSource_setVelocity},
+        {"stop", lua_AudioSource_stop},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"create", lua_AudioSource_static_create},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("AudioSource", lua_members, NULL, lua_AudioSource__gc, lua_statics, scopePath);
+}
+
+static AudioSource* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AudioSource");
+    luaL_argcheck(state, userdata != NULL, 1, "'AudioSource' expected.");
+    return (AudioSource*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_AudioSource__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, "AudioSource");
+                luaL_argcheck(state, userdata != NULL, 1, "'AudioSource' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    AudioSource* instance = (AudioSource*)object->instance;
+                    SAFE_RELEASE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_addRef(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)
+            {
+                AudioSource* instance = getInstance(state);
+                instance->addRef();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_getGain(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)
+            {
+                AudioSource* instance = getInstance(state);
+                float result = instance->getGain();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_getNode(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)
+            {
+                AudioSource* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getNode();
+                object->owns = false;
+                luaL_getmetatable(state, "Node");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_getPitch(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)
+            {
+                AudioSource* instance = getInstance(state);
+                float result = instance->getPitch();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_getRefCount(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)
+            {
+                AudioSource* instance = getInstance(state);
+                unsigned int result = instance->getRefCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_getState(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)
+            {
+                AudioSource* instance = getInstance(state);
+                AudioSource::State result = instance->getState();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_AudioSourceState(result).c_str());
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_getVelocity(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)
+            {
+                AudioSource* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getVelocity());
+                object->owns = false;
+                luaL_getmetatable(state, "Vector3");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_isLooped(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)
+            {
+                AudioSource* instance = getInstance(state);
+                bool result = instance->isLooped();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_pause(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)
+            {
+                AudioSource* instance = getInstance(state);
+                instance->pause();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_play(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)
+            {
+                AudioSource* instance = getInstance(state);
+                instance->play();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_release(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)
+            {
+                AudioSource* instance = getInstance(state);
+                instance->release();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_resume(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)
+            {
+                AudioSource* instance = getInstance(state);
+                instance->resume();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_rewind(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)
+            {
+                AudioSource* instance = getInstance(state);
+                instance->rewind();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_setGain(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                AudioSource* instance = getInstance(state);
+                instance->setGain(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AudioSource_setLooped(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                AudioSource* instance = getInstance(state);
+                instance->setLooped(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AudioSource_setPitch(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                AudioSource* instance = getInstance(state);
+                instance->setPitch(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AudioSource_setVelocity(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                AudioSource* instance = getInstance(state);
+                instance->setVelocity(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AudioSource_static_create(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_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 1);
+
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)AudioSource::create(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "AudioSource");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata1 = ScriptController::getInstance()->getObjectPointer(1, "Properties");
+                if (!userdata1)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Properties' for parameter 1.");
+                    lua_error(state);
+                }
+                Properties* param1 = (Properties*)((ScriptController::LuaObject*)userdata1)->instance;
+
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)AudioSource::create(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "AudioSource");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_AudioSource_stop(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)
+            {
+                AudioSource* instance = getInstance(state);
+                instance->stop();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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;
+}
+
+}

+ 33 - 0
gameplay/src/lua/lua_AudioSource.h

@@ -0,0 +1,33 @@
+#ifndef LUA_AUDIOSOURCE_H_
+#define LUA_AUDIOSOURCE_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AudioSource.
+int lua_AudioSource__gc(lua_State* state);
+int lua_AudioSource_addRef(lua_State* state);
+int lua_AudioSource_getGain(lua_State* state);
+int lua_AudioSource_getNode(lua_State* state);
+int lua_AudioSource_getPitch(lua_State* state);
+int lua_AudioSource_getRefCount(lua_State* state);
+int lua_AudioSource_getState(lua_State* state);
+int lua_AudioSource_getVelocity(lua_State* state);
+int lua_AudioSource_isLooped(lua_State* state);
+int lua_AudioSource_pause(lua_State* state);
+int lua_AudioSource_play(lua_State* state);
+int lua_AudioSource_release(lua_State* state);
+int lua_AudioSource_resume(lua_State* state);
+int lua_AudioSource_rewind(lua_State* state);
+int lua_AudioSource_setGain(lua_State* state);
+int lua_AudioSource_setLooped(lua_State* state);
+int lua_AudioSource_setPitch(lua_State* state);
+int lua_AudioSource_setVelocity(lua_State* state);
+int lua_AudioSource_static_create(lua_State* state);
+int lua_AudioSource_stop(lua_State* state);
+
+void luaRegister_AudioSource();
+
+}
+
+#endif

+ 754 - 0
gameplay/src/lua/lua_BoundingBox.cpp

@@ -0,0 +1,754 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "BoundingBox.h"
+#include "lua_BoundingBox.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_BoundingBox()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"getCenter", lua_BoundingBox_getCenter},
+        {"getCorners", lua_BoundingBox_getCorners},
+        {"intersects", lua_BoundingBox_intersects},
+        {"isEmpty", lua_BoundingBox_isEmpty},
+        {"max", lua_BoundingBox_max},
+        {"merge", lua_BoundingBox_merge},
+        {"min", lua_BoundingBox_min},
+        {"set", lua_BoundingBox_set},
+        {"transform", lua_BoundingBox_transform},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"empty", lua_BoundingBox_static_empty},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("BoundingBox", lua_members, lua_BoundingBox__init, lua_BoundingBox__gc, lua_statics, scopePath);
+}
+
+static BoundingBox* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "BoundingBox");
+    luaL_argcheck(state, userdata != NULL, 1, "'BoundingBox' expected.");
+    return (BoundingBox*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_BoundingBox__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, "BoundingBox");
+                luaL_argcheck(state, userdata != NULL, 1, "'BoundingBox' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    BoundingBox* instance = (BoundingBox*)object->instance;
+                    SAFE_DELETE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_BoundingBox__init(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 0:
+        {
+            ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+            object->instance = (void*)new BoundingBox();
+            object->owns = true;
+            luaL_getmetatable(state, "BoundingBox");
+            lua_setmetatable(state, -2);
+
+            return 1;
+            break;
+        }
+        case 1:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata1 = ScriptController::getInstance()->getObjectPointer(1, "BoundingBox");
+                if (!userdata1)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingBox' for parameter 1.");
+                    lua_error(state);
+                }
+                BoundingBox* param1 = (BoundingBox*)((ScriptController::LuaObject*)userdata1)->instance;
+
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)new BoundingBox(*param1);
+                object->owns = true;
+                luaL_getmetatable(state, "BoundingBox");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata1 = ScriptController::getInstance()->getObjectPointer(1, "Vector3");
+                if (!userdata1)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 1.");
+                    lua_error(state);
+                }
+                Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata1)->instance;
+
+                // Get parameter 2 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector3* param2 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)new BoundingBox(*param1, *param2);
+                object->owns = true;
+                luaL_getmetatable(state, "BoundingBox");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 0, 1 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingBox_getCenter(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)
+            {
+                BoundingBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)new Vector3(instance->getCenter());
+                object->owns = true;
+                luaL_getmetatable(state, "Vector3");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                instance->getCenter(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingBox_getCorners(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                instance->getCorners(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingBox_intersects(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingBox");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingBox' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingBox* param1 = (BoundingBox*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                bool result = instance->intersects(*param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingSphere");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingSphere' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingSphere* param1 = (BoundingSphere*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                bool result = instance->intersects(*param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Frustum");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Frustum' for parameter 2.");
+                    lua_error(state);
+                }
+                Frustum* param1 = (Frustum*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                bool result = instance->intersects(*param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Plane");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Plane' for parameter 2.");
+                    lua_error(state);
+                }
+                Plane* param1 = (Plane*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                float result = instance->intersects(*param1);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Ray");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Ray' for parameter 2.");
+                    lua_error(state);
+                }
+                Ray* param1 = (Ray*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                float result = instance->intersects(*param1);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingBox_isEmpty(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)
+            {
+                BoundingBox* instance = getInstance(state);
+                bool result = instance->isEmpty();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_BoundingBox_max(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 2)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
+        lua_error(state);
+    }
+
+    BoundingBox* instance = getInstance(state);
+    if (lua_gettop(state) == 2)
+    {
+        // Get parameter 2 off the stack.
+        void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+        if (!userdata2)
+        {
+            lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+            lua_error(state);
+        }
+        Vector3* param2 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+        instance->max = *param2;
+        return 0;
+    }
+    else
+    {
+        ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+        object->instance = (void*)new Vector3(instance->max);
+        object->owns = true;
+        luaL_getmetatable(state, "Vector3");
+        lua_setmetatable(state, -2);
+
+        return 1;
+    }
+}
+
+int lua_BoundingBox_merge(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingSphere");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingSphere' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingSphere* param1 = (BoundingSphere*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                instance->merge(*param1);
+                
+                return 0;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingBox");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingBox' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingBox* param1 = (BoundingBox*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                instance->merge(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingBox_min(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 2)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
+        lua_error(state);
+    }
+
+    BoundingBox* instance = getInstance(state);
+    if (lua_gettop(state) == 2)
+    {
+        // Get parameter 2 off the stack.
+        void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+        if (!userdata2)
+        {
+            lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+            lua_error(state);
+        }
+        Vector3* param2 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+        instance->min = *param2;
+        return 0;
+    }
+    else
+    {
+        ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+        object->instance = (void*)new Vector3(instance->min);
+        object->owns = true;
+        luaL_getmetatable(state, "Vector3");
+        lua_setmetatable(state, -2);
+
+        return 1;
+    }
+}
+
+int lua_BoundingBox_set(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingBox");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingBox' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingBox* param1 = (BoundingBox*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                instance->set(*param1);
+                
+                return 0;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingSphere");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingSphere' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingSphere* param1 = (BoundingSphere*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                instance->set(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Vector3");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 3.");
+                    lua_error(state);
+                }
+                Vector3* param2 = (Vector3*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                instance->set(*param1, *param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingBox_static_empty(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 0:
+        {
+            ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+            object->instance = (void*)&(BoundingBox::empty());
+            object->owns = false;
+            luaL_getmetatable(state, "BoundingBox");
+            lua_setmetatable(state, -2);
+
+            return 1;
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 0).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingBox_transform(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Matrix");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Matrix' for parameter 2.");
+                    lua_error(state);
+                }
+                Matrix* param1 = (Matrix*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingBox* instance = getInstance(state);
+                instance->transform(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+}

+ 25 - 0
gameplay/src/lua/lua_BoundingBox.h

@@ -0,0 +1,25 @@
+#ifndef LUA_BOUNDINGBOX_H_
+#define LUA_BOUNDINGBOX_H_
+
+namespace gameplay
+{
+
+// Lua bindings for BoundingBox.
+int lua_BoundingBox__gc(lua_State* state);
+int lua_BoundingBox__init(lua_State* state);
+int lua_BoundingBox_getCenter(lua_State* state);
+int lua_BoundingBox_getCorners(lua_State* state);
+int lua_BoundingBox_intersects(lua_State* state);
+int lua_BoundingBox_isEmpty(lua_State* state);
+int lua_BoundingBox_max(lua_State* state);
+int lua_BoundingBox_merge(lua_State* state);
+int lua_BoundingBox_min(lua_State* state);
+int lua_BoundingBox_set(lua_State* state);
+int lua_BoundingBox_static_empty(lua_State* state);
+int lua_BoundingBox_transform(lua_State* state);
+
+void luaRegister_BoundingBox();
+
+}
+
+#endif

+ 625 - 0
gameplay/src/lua/lua_BoundingSphere.cpp

@@ -0,0 +1,625 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "BoundingSphere.h"
+#include "lua_BoundingSphere.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_BoundingSphere()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"center", lua_BoundingSphere_center},
+        {"intersects", lua_BoundingSphere_intersects},
+        {"isEmpty", lua_BoundingSphere_isEmpty},
+        {"merge", lua_BoundingSphere_merge},
+        {"radius", lua_BoundingSphere_radius},
+        {"set", lua_BoundingSphere_set},
+        {"transform", lua_BoundingSphere_transform},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"empty", lua_BoundingSphere_static_empty},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("BoundingSphere", lua_members, lua_BoundingSphere__init, lua_BoundingSphere__gc, lua_statics, scopePath);
+}
+
+static BoundingSphere* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "BoundingSphere");
+    luaL_argcheck(state, userdata != NULL, 1, "'BoundingSphere' expected.");
+    return (BoundingSphere*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_BoundingSphere__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, "BoundingSphere");
+                luaL_argcheck(state, userdata != NULL, 1, "'BoundingSphere' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    BoundingSphere* instance = (BoundingSphere*)object->instance;
+                    SAFE_DELETE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_BoundingSphere__init(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 0:
+        {
+            ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+            object->instance = (void*)new BoundingSphere();
+            object->owns = true;
+            luaL_getmetatable(state, "BoundingSphere");
+            lua_setmetatable(state, -2);
+
+            return 1;
+            break;
+        }
+        case 1:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata1 = ScriptController::getInstance()->getObjectPointer(1, "BoundingSphere");
+                if (!userdata1)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingSphere' for parameter 1.");
+                    lua_error(state);
+                }
+                BoundingSphere* param1 = (BoundingSphere*)((ScriptController::LuaObject*)userdata1)->instance;
+
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)new BoundingSphere(*param1);
+                object->owns = true;
+                luaL_getmetatable(state, "BoundingSphere");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata1 = ScriptController::getInstance()->getObjectPointer(1, "Vector3");
+                if (!userdata1)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 1.");
+                    lua_error(state);
+                }
+                Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata1)->instance;
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 2);
+
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)new BoundingSphere(*param1, param2);
+                object->owns = true;
+                luaL_getmetatable(state, "BoundingSphere");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 0, 1 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingSphere_center(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 2)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
+        lua_error(state);
+    }
+
+    BoundingSphere* instance = getInstance(state);
+    if (lua_gettop(state) == 2)
+    {
+        // Get parameter 2 off the stack.
+        void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+        if (!userdata2)
+        {
+            lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+            lua_error(state);
+        }
+        Vector3* param2 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+        instance->center = *param2;
+        return 0;
+    }
+    else
+    {
+        ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+        object->instance = (void*)new Vector3(instance->center);
+        object->owns = true;
+        luaL_getmetatable(state, "Vector3");
+        lua_setmetatable(state, -2);
+
+        return 1;
+    }
+}
+
+int lua_BoundingSphere_intersects(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingSphere");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingSphere' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingSphere* param1 = (BoundingSphere*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingSphere* instance = getInstance(state);
+                bool result = instance->intersects(*param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingBox");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingBox' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingBox* param1 = (BoundingBox*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingSphere* instance = getInstance(state);
+                bool result = instance->intersects(*param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Frustum");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Frustum' for parameter 2.");
+                    lua_error(state);
+                }
+                Frustum* param1 = (Frustum*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingSphere* instance = getInstance(state);
+                bool result = instance->intersects(*param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Plane");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Plane' for parameter 2.");
+                    lua_error(state);
+                }
+                Plane* param1 = (Plane*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingSphere* instance = getInstance(state);
+                float result = instance->intersects(*param1);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Ray");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Ray' for parameter 2.");
+                    lua_error(state);
+                }
+                Ray* param1 = (Ray*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingSphere* instance = getInstance(state);
+                float result = instance->intersects(*param1);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingSphere_isEmpty(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)
+            {
+                BoundingSphere* instance = getInstance(state);
+                bool result = instance->isEmpty();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_BoundingSphere_merge(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingSphere");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingSphere' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingSphere* param1 = (BoundingSphere*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingSphere* instance = getInstance(state);
+                instance->merge(*param1);
+                
+                return 0;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingBox");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingBox' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingBox* param1 = (BoundingBox*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingSphere* instance = getInstance(state);
+                instance->merge(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingSphere_radius(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 2)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
+        lua_error(state);
+    }
+
+    BoundingSphere* instance = getInstance(state);
+    if (lua_gettop(state) == 2)
+    {
+        // Get parameter 2 off the stack.
+        float param2 = (float)luaL_checknumber(state, 2);
+
+        instance->radius = param2;
+        return 0;
+    }
+    else
+    {
+        float result = instance->radius;
+
+        // Push the return value onto the stack.
+        lua_pushnumber(state, result);
+
+        return 1;
+    }
+}
+
+int lua_BoundingSphere_set(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingSphere");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingSphere' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingSphere* param1 = (BoundingSphere*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingSphere* instance = getInstance(state);
+                instance->set(*param1);
+                
+                return 0;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "BoundingBox");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'BoundingBox' for parameter 2.");
+                    lua_error(state);
+                }
+                BoundingBox* param1 = (BoundingBox*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingSphere* instance = getInstance(state);
+                instance->set(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector3");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector3* param1 = (Vector3*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                BoundingSphere* instance = getInstance(state);
+                instance->set(*param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingSphere_static_empty(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 0:
+        {
+            ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+            object->instance = (void*)&(BoundingSphere::empty());
+            object->owns = false;
+            luaL_getmetatable(state, "BoundingSphere");
+            lua_setmetatable(state, -2);
+
+            return 1;
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 0).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_BoundingSphere_transform(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Matrix");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Matrix' for parameter 2.");
+                    lua_error(state);
+                }
+                Matrix* param1 = (Matrix*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                BoundingSphere* instance = getInstance(state);
+                instance->transform(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+}

+ 23 - 0
gameplay/src/lua/lua_BoundingSphere.h

@@ -0,0 +1,23 @@
+#ifndef LUA_BOUNDINGSPHERE_H_
+#define LUA_BOUNDINGSPHERE_H_
+
+namespace gameplay
+{
+
+// Lua bindings for BoundingSphere.
+int lua_BoundingSphere__gc(lua_State* state);
+int lua_BoundingSphere__init(lua_State* state);
+int lua_BoundingSphere_center(lua_State* state);
+int lua_BoundingSphere_intersects(lua_State* state);
+int lua_BoundingSphere_isEmpty(lua_State* state);
+int lua_BoundingSphere_merge(lua_State* state);
+int lua_BoundingSphere_radius(lua_State* state);
+int lua_BoundingSphere_set(lua_State* state);
+int lua_BoundingSphere_static_empty(lua_State* state);
+int lua_BoundingSphere_transform(lua_State* state);
+
+void luaRegister_BoundingSphere();
+
+}
+
+#endif

+ 537 - 0
gameplay/src/lua/lua_Bundle.cpp

@@ -0,0 +1,537 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "Bundle.h"
+#include "lua_Bundle.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_Bundle()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"addRef", lua_Bundle_addRef},
+        {"contains", lua_Bundle_contains},
+        {"getObjectCount", lua_Bundle_getObjectCount},
+        {"getObjectID", lua_Bundle_getObjectID},
+        {"getRefCount", lua_Bundle_getRefCount},
+        {"loadFont", lua_Bundle_loadFont},
+        {"loadMesh", lua_Bundle_loadMesh},
+        {"loadNode", lua_Bundle_loadNode},
+        {"loadScene", lua_Bundle_loadScene},
+        {"release", lua_Bundle_release},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"create", lua_Bundle_static_create},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("Bundle", lua_members, NULL, lua_Bundle__gc, lua_statics, scopePath);
+}
+
+static Bundle* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "Bundle");
+    luaL_argcheck(state, userdata != NULL, 1, "'Bundle' expected.");
+    return (Bundle*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_Bundle__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, "Bundle");
+                luaL_argcheck(state, userdata != NULL, 1, "'Bundle' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    Bundle* instance = (Bundle*)object->instance;
+                    SAFE_RELEASE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Bundle_addRef(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)
+            {
+                Bundle* instance = getInstance(state);
+                instance->addRef();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Bundle_contains(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Bundle* instance = getInstance(state);
+                bool result = instance->contains(param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Bundle_getObjectCount(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)
+            {
+                Bundle* instance = getInstance(state);
+                unsigned int result = instance->getObjectCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Bundle_getObjectID(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                Bundle* instance = getInstance(state);
+                const char* result = instance->getObjectID(param1);
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Bundle_getRefCount(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)
+            {
+                Bundle* instance = getInstance(state);
+                unsigned int result = instance->getRefCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Bundle_loadFont(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Bundle* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->loadFont(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "Font");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Bundle_loadMesh(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Bundle* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->loadMesh(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "Mesh");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Bundle_loadNode(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Bundle* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->loadNode(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "Node");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Bundle_loadScene(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)
+            {
+                Bundle* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->loadScene();
+                object->owns = false;
+                luaL_getmetatable(state, "Scene");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Bundle* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->loadScene(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "Scene");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Bundle_release(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)
+            {
+                Bundle* instance = getInstance(state);
+                instance->release();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Bundle_static_create(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_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 1);
+
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)Bundle::create(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "Bundle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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;
+}
+
+}

+ 25 - 0
gameplay/src/lua/lua_Bundle.h

@@ -0,0 +1,25 @@
+#ifndef LUA_BUNDLE_H_
+#define LUA_BUNDLE_H_
+
+namespace gameplay
+{
+
+// Lua bindings for Bundle.
+int lua_Bundle__gc(lua_State* state);
+int lua_Bundle_addRef(lua_State* state);
+int lua_Bundle_contains(lua_State* state);
+int lua_Bundle_getObjectCount(lua_State* state);
+int lua_Bundle_getObjectID(lua_State* state);
+int lua_Bundle_getRefCount(lua_State* state);
+int lua_Bundle_loadFont(lua_State* state);
+int lua_Bundle_loadMesh(lua_State* state);
+int lua_Bundle_loadNode(lua_State* state);
+int lua_Bundle_loadScene(lua_State* state);
+int lua_Bundle_release(lua_State* state);
+int lua_Bundle_static_create(lua_State* state);
+
+void luaRegister_Bundle();
+
+}
+
+#endif

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

@@ -0,0 +1,4024 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "Button.h"
+#include "lua_Button.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_Button()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"addListener", lua_Button_addListener},
+        {"addRef", lua_Button_addRef},
+        {"createAnimation", lua_Button_createAnimation},
+        {"createAnimationFromBy", lua_Button_createAnimationFromBy},
+        {"createAnimationFromTo", lua_Button_createAnimationFromTo},
+        {"destroyAnimation", lua_Button_destroyAnimation},
+        {"disable", lua_Button_disable},
+        {"enable", lua_Button_enable},
+        {"getAlignment", lua_Button_getAlignment},
+        {"getAnimation", lua_Button_getAnimation},
+        {"getAnimationPropertyComponentCount", lua_Button_getAnimationPropertyComponentCount},
+        {"getAnimationPropertyValue", lua_Button_getAnimationPropertyValue},
+        {"getAutoHeight", lua_Button_getAutoHeight},
+        {"getAutoWidth", lua_Button_getAutoWidth},
+        {"getBorder", lua_Button_getBorder},
+        {"getBounds", lua_Button_getBounds},
+        {"getClip", lua_Button_getClip},
+        {"getClipBounds", lua_Button_getClipBounds},
+        {"getConsumeTouchEvents", lua_Button_getConsumeTouchEvents},
+        {"getCursorColor", lua_Button_getCursorColor},
+        {"getCursorRegion", lua_Button_getCursorRegion},
+        {"getCursorUVs", lua_Button_getCursorUVs},
+        {"getFont", lua_Button_getFont},
+        {"getFontSize", lua_Button_getFontSize},
+        {"getHeight", lua_Button_getHeight},
+        {"getID", lua_Button_getID},
+        {"getImageColor", lua_Button_getImageColor},
+        {"getImageRegion", lua_Button_getImageRegion},
+        {"getImageUVs", lua_Button_getImageUVs},
+        {"getMargin", lua_Button_getMargin},
+        {"getOpacity", lua_Button_getOpacity},
+        {"getPadding", lua_Button_getPadding},
+        {"getRefCount", lua_Button_getRefCount},
+        {"getSkinColor", lua_Button_getSkinColor},
+        {"getSkinRegion", lua_Button_getSkinRegion},
+        {"getState", lua_Button_getState},
+        {"getStyle", lua_Button_getStyle},
+        {"getText", lua_Button_getText},
+        {"getTextAlignment", lua_Button_getTextAlignment},
+        {"getTextColor", lua_Button_getTextColor},
+        {"getTextRightToLeft", lua_Button_getTextRightToLeft},
+        {"getWidth", lua_Button_getWidth},
+        {"getX", lua_Button_getX},
+        {"getY", lua_Button_getY},
+        {"getZIndex", lua_Button_getZIndex},
+        {"isEnabled", lua_Button_isEnabled},
+        {"release", lua_Button_release},
+        {"setAlignment", lua_Button_setAlignment},
+        {"setAnimationPropertyValue", lua_Button_setAnimationPropertyValue},
+        {"setAutoHeight", lua_Button_setAutoHeight},
+        {"setAutoWidth", lua_Button_setAutoWidth},
+        {"setBorder", lua_Button_setBorder},
+        {"setBounds", lua_Button_setBounds},
+        {"setConsumeTouchEvents", lua_Button_setConsumeTouchEvents},
+        {"setCursorColor", lua_Button_setCursorColor},
+        {"setCursorRegion", lua_Button_setCursorRegion},
+        {"setFont", lua_Button_setFont},
+        {"setFontSize", lua_Button_setFontSize},
+        {"setImageColor", lua_Button_setImageColor},
+        {"setImageRegion", lua_Button_setImageRegion},
+        {"setMargin", lua_Button_setMargin},
+        {"setOpacity", lua_Button_setOpacity},
+        {"setPadding", lua_Button_setPadding},
+        {"setPosition", lua_Button_setPosition},
+        {"setSize", lua_Button_setSize},
+        {"setSkinColor", lua_Button_setSkinColor},
+        {"setSkinRegion", lua_Button_setSkinRegion},
+        {"setState", lua_Button_setState},
+        {"setStyle", lua_Button_setStyle},
+        {"setText", lua_Button_setText},
+        {"setTextAlignment", lua_Button_setTextAlignment},
+        {"setTextColor", lua_Button_setTextColor},
+        {"setTextRightToLeft", lua_Button_setTextRightToLeft},
+        {"setZIndex", lua_Button_setZIndex},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"ANIMATE_OPACITY", lua_Button_static_ANIMATE_OPACITY},
+        {"ANIMATE_POSITION", lua_Button_static_ANIMATE_POSITION},
+        {"ANIMATE_POSITION_X", lua_Button_static_ANIMATE_POSITION_X},
+        {"ANIMATE_POSITION_Y", lua_Button_static_ANIMATE_POSITION_Y},
+        {"ANIMATE_SIZE", lua_Button_static_ANIMATE_SIZE},
+        {"ANIMATE_SIZE_HEIGHT", lua_Button_static_ANIMATE_SIZE_HEIGHT},
+        {"ANIMATE_SIZE_WIDTH", lua_Button_static_ANIMATE_SIZE_WIDTH},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("Button", lua_members, NULL, lua_Button__gc, lua_statics, scopePath);
+}
+
+static Button* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "Button");
+    luaL_argcheck(state, userdata != NULL, 1, "'Button' expected.");
+    return (Button*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_Button__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, "Button");
+                luaL_argcheck(state, userdata != NULL, 1, "'Button' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    Button* instance = (Button*)object->instance;
+                    SAFE_RELEASE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_addListener(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_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "ControlListener");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Control::Listener' for parameter 2.");
+                    lua_error(state);
+                }
+                Control::Listener* param1 = (Control::Listener*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->addListener(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_addRef(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)
+            {
+                Button* instance = getInstance(state);
+                instance->addRef();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_createAnimation(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, 3) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                const char* param2 = luaL_checkstring(state, 3);
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Properties");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Properties' for parameter 3.");
+                    lua_error(state);
+                }
+                Properties* param2 = (Properties*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 7:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 7) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
+
+                // Get parameter 4 off the stack.
+                unsigned long* param4 = ScriptController::getInstance()->getUnsignedLongPointer(5);
+
+                // Get parameter 5 off the stack.
+                float* param5 = ScriptController::getInstance()->getFloatPointer(6);
+
+                // Get parameter 6 off the stack.
+                Curve::InterpolationType param6 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 7));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 9:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 8) == LUA_TTABLE || lua_type(state, 8) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 9) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
+
+                // Get parameter 4 off the stack.
+                unsigned long* param4 = ScriptController::getInstance()->getUnsignedLongPointer(5);
+
+                // Get parameter 5 off the stack.
+                float* param5 = ScriptController::getInstance()->getFloatPointer(6);
+
+                // Get parameter 6 off the stack.
+                float* param6 = ScriptController::getInstance()->getFloatPointer(7);
+
+                // Get parameter 7 off the stack.
+                float* param7 = ScriptController::getInstance()->getFloatPointer(8);
+
+                // Get parameter 8 off the stack.
+                Curve::InterpolationType param8 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 9));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6, param7, param8);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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, 7 or 9).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_createAnimationFromBy(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 7:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 6) == LUA_TSTRING &&
+                lua_type(state, 7) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                float* param3 = ScriptController::getInstance()->getFloatPointer(4);
+
+                // Get parameter 4 off the stack.
+                float* param4 = ScriptController::getInstance()->getFloatPointer(5);
+
+                // Get parameter 5 off the stack.
+                Curve::InterpolationType param5 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 6));
+
+                // Get parameter 6 off the stack.
+                unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimationFromBy(param1, param2, param3, param4, param5, param6);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 7).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_createAnimationFromTo(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 7:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 6) == LUA_TSTRING &&
+                lua_type(state, 7) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                float* param3 = ScriptController::getInstance()->getFloatPointer(4);
+
+                // Get parameter 4 off the stack.
+                float* param4 = ScriptController::getInstance()->getFloatPointer(5);
+
+                // Get parameter 5 off the stack.
+                Curve::InterpolationType param5 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 6));
+
+                // Get parameter 6 off the stack.
+                unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimationFromTo(param1, param2, param3, param4, param5, param6);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 7).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_destroyAnimation(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)
+            {
+                Button* instance = getInstance(state);
+                instance->destroyAnimation();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Button* instance = getInstance(state);
+                instance->destroyAnimation(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_disable(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)
+            {
+                Button* instance = getInstance(state);
+                instance->disable();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_enable(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)
+            {
+                Button* instance = getInstance(state);
+                instance->enable();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getAlignment(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)
+            {
+                Button* instance = getInstance(state);
+                Control::Alignment result = instance->getAlignment();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_ControlAlignment(result).c_str());
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getAnimation(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getAnimation();
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getAnimation(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getAnimationPropertyComponentCount(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                Button* instance = getInstance(state);
+                unsigned int result = instance->getAnimationPropertyComponentCount(param1);
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getAnimationPropertyValue(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
+                    lua_error(state);
+                }
+                AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                Button* instance = getInstance(state);
+                instance->getAnimationPropertyValue(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_getAutoHeight(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)
+            {
+                Button* instance = getInstance(state);
+                bool result = instance->getAutoHeight();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getAutoWidth(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)
+            {
+                Button* instance = getInstance(state);
+                bool result = instance->getAutoWidth();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getBorder(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getBorder());
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeSideRegions");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getBorder(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeSideRegions");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getBounds(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getBounds());
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getClip(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getClip());
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getClipBounds(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getClipBounds());
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getConsumeTouchEvents(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)
+            {
+                Button* instance = getInstance(state);
+                bool result = instance->getConsumeTouchEvents();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getCursorColor(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getCursorColor(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getCursorRegion(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getCursorRegion(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getCursorUVs(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getCursorUVs(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeUVs");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getFont(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getFont();
+                object->owns = false;
+                luaL_getmetatable(state, "Font");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getFont(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "Font");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getFontSize(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)
+            {
+                Button* instance = getInstance(state);
+                unsigned int result = instance->getFontSize();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                unsigned int result = instance->getFontSize(param1);
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getHeight(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)
+            {
+                Button* instance = getInstance(state);
+                float result = instance->getHeight();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getID(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)
+            {
+                Button* instance = getInstance(state);
+                const char* result = instance->getID();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getImageColor(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, 3) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                Control::State param2 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 3));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getImageColor(param1, param2));
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_getImageRegion(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, 3) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                Control::State param2 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 3));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getImageRegion(param1, param2));
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_getImageUVs(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, 3) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                Control::State param2 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 3));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getImageUVs(param1, param2));
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeUVs");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_getMargin(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getMargin());
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeSideRegions");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getOpacity(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)
+            {
+                Button* instance = getInstance(state);
+                float result = instance->getOpacity();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                float result = instance->getOpacity(param1);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getPadding(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getPadding());
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeSideRegions");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getRefCount(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)
+            {
+                Button* instance = getInstance(state);
+                unsigned int result = instance->getRefCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getSkinColor(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getSkinColor());
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getSkinColor(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getSkinRegion(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getSkinRegion());
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getSkinRegion(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getState(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)
+            {
+                Button* instance = getInstance(state);
+                Control::State result = instance->getState();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_ControlState(result).c_str());
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getStyle(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getStyle();
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeStyle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getText(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)
+            {
+                Button* instance = getInstance(state);
+                const char* result = instance->getText();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getTextAlignment(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)
+            {
+                Button* instance = getInstance(state);
+                Font::Justify result = instance->getTextAlignment();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_FontJustify(result).c_str());
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                Font::Justify result = instance->getTextAlignment(param1);
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_FontJustify(result).c_str());
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getTextColor(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)
+            {
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getTextColor());
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getTextColor(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getTextRightToLeft(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)
+            {
+                Button* instance = getInstance(state);
+                bool result = instance->getTextRightToLeft();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                bool result = instance->getTextRightToLeft(param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_getWidth(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)
+            {
+                Button* instance = getInstance(state);
+                float result = instance->getWidth();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getX(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)
+            {
+                Button* instance = getInstance(state);
+                float result = instance->getX();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getY(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)
+            {
+                Button* instance = getInstance(state);
+                float result = instance->getY();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_getZIndex(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)
+            {
+                Button* instance = getInstance(state);
+                int result = instance->getZIndex();
+
+                // Push the return value onto the stack.
+                lua_pushinteger(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_isEnabled(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)
+            {
+                Button* instance = getInstance(state);
+                bool result = instance->isEnabled();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_release(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)
+            {
+                Button* instance = getInstance(state);
+                instance->release();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Button_setAlignment(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::Alignment param1 = (Control::Alignment)lua_enumFromString_ControlAlignment(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                instance->setAlignment(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setAnimationPropertyValue(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
+                    lua_error(state);
+                }
+                AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                Button* instance = getInstance(state);
+                instance->setAnimationPropertyValue(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 4:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TUSERDATA &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
+                    lua_error(state);
+                }
+                AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                Button* instance = getInstance(state);
+                instance->setAnimationPropertyValue(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setAutoHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                Button* instance = getInstance(state);
+                instance->setAutoHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setAutoWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                Button* instance = getInstance(state);
+                instance->setAutoWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setBorder(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 5:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                Button* instance = getInstance(state);
+                instance->setBorder(param1, param2, param3, param4);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 6:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 5 off the stack.
+                unsigned char param5 = (unsigned char)luaL_checkunsigned(state, 6);
+
+                Button* instance = getInstance(state);
+                instance->setBorder(param1, param2, param3, param4, param5);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 5 or 6).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                Button* instance = getInstance(state);
+                instance->setBounds(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setConsumeTouchEvents(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                Button* instance = getInstance(state);
+                instance->setConsumeTouchEvents(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setCursorColor(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_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setCursorColor(*param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_setCursorRegion(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_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setCursorRegion(*param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_setFont(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Font");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Font' for parameter 2.");
+                    lua_error(state);
+                }
+                Font* param1 = (Font*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                Button* instance = getInstance(state);
+                instance->setFont(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Font");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Font' for parameter 2.");
+                    lua_error(state);
+                }
+                Font* param1 = (Font*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setFont(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setFontSize(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                Button* instance = getInstance(state);
+                instance->setFontSize(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setFontSize(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setImageColor(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, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Vector4");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 3.");
+                    lua_error(state);
+                }
+                Vector4* param2 = (Vector4*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                Button* instance = getInstance(state);
+                instance->setImageColor(param1, *param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 4:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TUSERDATA &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Vector4");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 3.");
+                    lua_error(state);
+                }
+                Vector4* param2 = (Vector4*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                // Get parameter 3 off the stack.
+                unsigned char param3 = (unsigned char)luaL_checkunsigned(state, 4);
+
+                Button* instance = getInstance(state);
+                instance->setImageColor(param1, *param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setImageRegion(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, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Rectangle");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 3.");
+                    lua_error(state);
+                }
+                Rectangle* param2 = (Rectangle*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                Button* instance = getInstance(state);
+                instance->setImageRegion(param1, *param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 4:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TUSERDATA &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Rectangle");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 3.");
+                    lua_error(state);
+                }
+                Rectangle* param2 = (Rectangle*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                // Get parameter 3 off the stack.
+                unsigned char param3 = (unsigned char)luaL_checkunsigned(state, 4);
+
+                Button* instance = getInstance(state);
+                instance->setImageRegion(param1, *param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setMargin(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 5:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                Button* instance = getInstance(state);
+                instance->setMargin(param1, param2, param3, param4);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 5).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setOpacity(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Button* instance = getInstance(state);
+                instance->setOpacity(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setOpacity(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setPadding(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 5:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                Button* instance = getInstance(state);
+                instance->setPadding(param1, param2, param3, param4);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 5).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setPosition(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setPosition(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_setSize(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setSize(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_setSkinColor(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                Button* instance = getInstance(state);
+                instance->setSkinColor(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setSkinColor(*param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setSkinRegion(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                Button* instance = getInstance(state);
+                instance->setSkinRegion(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setSkinRegion(*param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setState(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                instance->setState(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setStyle(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "ThemeStyle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Theme::Style' for parameter 2.");
+                    lua_error(state);
+                }
+                Theme::Style* param1 = (Theme::Style*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                Button* instance = getInstance(state);
+                instance->setStyle(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setText(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                Button* instance = getInstance(state);
+                instance->setText(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setTextAlignment(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Font::Justify param1 = (Font::Justify)lua_enumFromString_FontJustify(luaL_checkstring(state, 2));
+
+                Button* instance = getInstance(state);
+                instance->setTextAlignment(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                Font::Justify param1 = (Font::Justify)lua_enumFromString_FontJustify(luaL_checkstring(state, 2));
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setTextAlignment(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setTextColor(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                Button* instance = getInstance(state);
+                instance->setTextColor(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setTextColor(*param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setTextRightToLeft(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                Button* instance = getInstance(state);
+                instance->setTextRightToLeft(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                Button* instance = getInstance(state);
+                instance->setTextRightToLeft(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_setZIndex(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                Button* instance = getInstance(state);
+                instance->setZIndex(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Button_static_ANIMATE_OPACITY(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = Button::ANIMATE_OPACITY;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_Button_static_ANIMATE_POSITION(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = Button::ANIMATE_POSITION;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_Button_static_ANIMATE_POSITION_X(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = Button::ANIMATE_POSITION_X;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_Button_static_ANIMATE_POSITION_Y(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = Button::ANIMATE_POSITION_Y;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_Button_static_ANIMATE_SIZE(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = Button::ANIMATE_SIZE;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_Button_static_ANIMATE_SIZE_HEIGHT(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = Button::ANIMATE_SIZE_HEIGHT;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_Button_static_ANIMATE_SIZE_WIDTH(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = Button::ANIMATE_SIZE_WIDTH;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+}

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

@@ -0,0 +1,95 @@
+#ifndef LUA_BUTTON_H_
+#define LUA_BUTTON_H_
+
+namespace gameplay
+{
+
+// Lua bindings for Button.
+int lua_Button__gc(lua_State* state);
+int lua_Button_addListener(lua_State* state);
+int lua_Button_addRef(lua_State* state);
+int lua_Button_createAnimation(lua_State* state);
+int lua_Button_createAnimationFromBy(lua_State* state);
+int lua_Button_createAnimationFromTo(lua_State* state);
+int lua_Button_destroyAnimation(lua_State* state);
+int lua_Button_disable(lua_State* state);
+int lua_Button_enable(lua_State* state);
+int lua_Button_getAlignment(lua_State* state);
+int lua_Button_getAnimation(lua_State* state);
+int lua_Button_getAnimationPropertyComponentCount(lua_State* state);
+int lua_Button_getAnimationPropertyValue(lua_State* state);
+int lua_Button_getAutoHeight(lua_State* state);
+int lua_Button_getAutoWidth(lua_State* state);
+int lua_Button_getBorder(lua_State* state);
+int lua_Button_getBounds(lua_State* state);
+int lua_Button_getClip(lua_State* state);
+int lua_Button_getClipBounds(lua_State* state);
+int lua_Button_getConsumeTouchEvents(lua_State* state);
+int lua_Button_getCursorColor(lua_State* state);
+int lua_Button_getCursorRegion(lua_State* state);
+int lua_Button_getCursorUVs(lua_State* state);
+int lua_Button_getFont(lua_State* state);
+int lua_Button_getFontSize(lua_State* state);
+int lua_Button_getHeight(lua_State* state);
+int lua_Button_getID(lua_State* state);
+int lua_Button_getImageColor(lua_State* state);
+int lua_Button_getImageRegion(lua_State* state);
+int lua_Button_getImageUVs(lua_State* state);
+int lua_Button_getMargin(lua_State* state);
+int lua_Button_getOpacity(lua_State* state);
+int lua_Button_getPadding(lua_State* state);
+int lua_Button_getRefCount(lua_State* state);
+int lua_Button_getSkinColor(lua_State* state);
+int lua_Button_getSkinRegion(lua_State* state);
+int lua_Button_getState(lua_State* state);
+int lua_Button_getStyle(lua_State* state);
+int lua_Button_getText(lua_State* state);
+int lua_Button_getTextAlignment(lua_State* state);
+int lua_Button_getTextColor(lua_State* state);
+int lua_Button_getTextRightToLeft(lua_State* state);
+int lua_Button_getWidth(lua_State* state);
+int lua_Button_getX(lua_State* state);
+int lua_Button_getY(lua_State* state);
+int lua_Button_getZIndex(lua_State* state);
+int lua_Button_isEnabled(lua_State* state);
+int lua_Button_release(lua_State* state);
+int lua_Button_setAlignment(lua_State* state);
+int lua_Button_setAnimationPropertyValue(lua_State* state);
+int lua_Button_setAutoHeight(lua_State* state);
+int lua_Button_setAutoWidth(lua_State* state);
+int lua_Button_setBorder(lua_State* state);
+int lua_Button_setBounds(lua_State* state);
+int lua_Button_setConsumeTouchEvents(lua_State* state);
+int lua_Button_setCursorColor(lua_State* state);
+int lua_Button_setCursorRegion(lua_State* state);
+int lua_Button_setFont(lua_State* state);
+int lua_Button_setFontSize(lua_State* state);
+int lua_Button_setImageColor(lua_State* state);
+int lua_Button_setImageRegion(lua_State* state);
+int lua_Button_setMargin(lua_State* state);
+int lua_Button_setOpacity(lua_State* state);
+int lua_Button_setPadding(lua_State* state);
+int lua_Button_setPosition(lua_State* state);
+int lua_Button_setSize(lua_State* state);
+int lua_Button_setSkinColor(lua_State* state);
+int lua_Button_setSkinRegion(lua_State* state);
+int lua_Button_setState(lua_State* state);
+int lua_Button_setStyle(lua_State* state);
+int lua_Button_setText(lua_State* state);
+int lua_Button_setTextAlignment(lua_State* state);
+int lua_Button_setTextColor(lua_State* state);
+int lua_Button_setTextRightToLeft(lua_State* state);
+int lua_Button_setZIndex(lua_State* state);
+int lua_Button_static_ANIMATE_OPACITY(lua_State* state);
+int lua_Button_static_ANIMATE_POSITION(lua_State* state);
+int lua_Button_static_ANIMATE_POSITION_X(lua_State* state);
+int lua_Button_static_ANIMATE_POSITION_Y(lua_State* state);
+int lua_Button_static_ANIMATE_SIZE(lua_State* state);
+int lua_Button_static_ANIMATE_SIZE_HEIGHT(lua_State* state);
+int lua_Button_static_ANIMATE_SIZE_WIDTH(lua_State* state);
+
+void luaRegister_Button();
+
+}
+
+#endif

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

@@ -0,0 +1,1306 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "Camera.h"
+#include "lua_Camera.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_Camera()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"addRef", lua_Camera_addRef},
+        {"getAspectRatio", lua_Camera_getAspectRatio},
+        {"getCameraType", lua_Camera_getCameraType},
+        {"getFarPlane", lua_Camera_getFarPlane},
+        {"getFieldOfView", lua_Camera_getFieldOfView},
+        {"getFrustum", lua_Camera_getFrustum},
+        {"getInverseViewMatrix", lua_Camera_getInverseViewMatrix},
+        {"getInverseViewProjectionMatrix", lua_Camera_getInverseViewProjectionMatrix},
+        {"getNearPlane", lua_Camera_getNearPlane},
+        {"getNode", lua_Camera_getNode},
+        {"getProjectionMatrix", lua_Camera_getProjectionMatrix},
+        {"getRefCount", lua_Camera_getRefCount},
+        {"getViewMatrix", lua_Camera_getViewMatrix},
+        {"getViewProjectionMatrix", lua_Camera_getViewProjectionMatrix},
+        {"getZoomX", lua_Camera_getZoomX},
+        {"getZoomY", lua_Camera_getZoomY},
+        {"pickRay", lua_Camera_pickRay},
+        {"project", lua_Camera_project},
+        {"release", lua_Camera_release},
+        {"setAspectRatio", lua_Camera_setAspectRatio},
+        {"setFarPlane", lua_Camera_setFarPlane},
+        {"setFieldOfView", lua_Camera_setFieldOfView},
+        {"setNearPlane", lua_Camera_setNearPlane},
+        {"setZoomX", lua_Camera_setZoomX},
+        {"setZoomY", lua_Camera_setZoomY},
+        {"unproject", lua_Camera_unproject},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"createOrthographic", lua_Camera_static_createOrthographic},
+        {"createPerspective", lua_Camera_static_createPerspective},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("Camera", lua_members, NULL, lua_Camera__gc, lua_statics, scopePath);
+}
+
+static Camera* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "Camera");
+    luaL_argcheck(state, userdata != NULL, 1, "'Camera' expected.");
+    return (Camera*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_Camera__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, "Camera");
+                luaL_argcheck(state, userdata != NULL, 1, "'Camera' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    Camera* instance = (Camera*)object->instance;
+                    SAFE_RELEASE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_addRef(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)
+            {
+                Camera* instance = getInstance(state);
+                instance->addRef();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getAspectRatio(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)
+            {
+                Camera* instance = getInstance(state);
+                float result = instance->getAspectRatio();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getCameraType(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)
+            {
+                Camera* instance = getInstance(state);
+                Camera::Type result = instance->getCameraType();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_CameraType(result).c_str());
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getFarPlane(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)
+            {
+                Camera* instance = getInstance(state);
+                float result = instance->getFarPlane();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getFieldOfView(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)
+            {
+                Camera* instance = getInstance(state);
+                float result = instance->getFieldOfView();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getFrustum(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)
+            {
+                Camera* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getFrustum());
+                object->owns = false;
+                luaL_getmetatable(state, "Frustum");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getInverseViewMatrix(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)
+            {
+                Camera* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getInverseViewMatrix());
+                object->owns = false;
+                luaL_getmetatable(state, "Matrix");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getInverseViewProjectionMatrix(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)
+            {
+                Camera* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getInverseViewProjectionMatrix());
+                object->owns = false;
+                luaL_getmetatable(state, "Matrix");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getNearPlane(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)
+            {
+                Camera* instance = getInstance(state);
+                float result = instance->getNearPlane();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getNode(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)
+            {
+                Camera* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getNode();
+                object->owns = false;
+                luaL_getmetatable(state, "Node");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getProjectionMatrix(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)
+            {
+                Camera* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getProjectionMatrix());
+                object->owns = false;
+                luaL_getmetatable(state, "Matrix");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getRefCount(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)
+            {
+                Camera* instance = getInstance(state);
+                unsigned int result = instance->getRefCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getViewMatrix(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)
+            {
+                Camera* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getViewMatrix());
+                object->owns = false;
+                luaL_getmetatable(state, "Matrix");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getViewProjectionMatrix(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)
+            {
+                Camera* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getViewProjectionMatrix());
+                object->owns = false;
+                luaL_getmetatable(state, "Matrix");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getZoomX(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)
+            {
+                Camera* instance = getInstance(state);
+                float result = instance->getZoomX();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_getZoomY(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)
+            {
+                Camera* instance = getInstance(state);
+                float result = instance->getZoomY();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_pickRay(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 5:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                void* userdata5 = ScriptController::getInstance()->getObjectPointer(5, "Ray");
+                if (!userdata5)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Ray' for parameter 5.");
+                    lua_error(state);
+                }
+                Ray* param4 = (Ray*)((ScriptController::LuaObject*)userdata5)->instance;
+
+                Camera* instance = getInstance(state);
+                instance->pickRay(*param1, param2, param3, param4);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 5).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Camera_project(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 5:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TUSERDATA &&
+                (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA))
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Vector3");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 3.");
+                    lua_error(state);
+                }
+                Vector3* param2 = (Vector3*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                // Get parameter 3 off the stack.
+                float* param3 = ScriptController::getInstance()->getFloatPointer(4);
+
+                // Get parameter 4 off the stack.
+                float* param4 = ScriptController::getInstance()->getFloatPointer(5);
+
+                Camera* instance = getInstance(state);
+                instance->project(*param1, *param2, param3, param4);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 6:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TUSERDATA &&
+                (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA))
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Vector3");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 3.");
+                    lua_error(state);
+                }
+                Vector3* param2 = (Vector3*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                // Get parameter 3 off the stack.
+                float* param3 = ScriptController::getInstance()->getFloatPointer(4);
+
+                // Get parameter 4 off the stack.
+                float* param4 = ScriptController::getInstance()->getFloatPointer(5);
+
+                // Get parameter 5 off the stack.
+                float* param5 = ScriptController::getInstance()->getFloatPointer(6);
+
+                Camera* instance = getInstance(state);
+                instance->project(*param1, *param2, param3, param4, param5);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 5 or 6).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Camera_release(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)
+            {
+                Camera* instance = getInstance(state);
+                instance->release();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_Camera_setAspectRatio(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Camera* instance = getInstance(state);
+                instance->setAspectRatio(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Camera_setFarPlane(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Camera* instance = getInstance(state);
+                instance->setFarPlane(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Camera_setFieldOfView(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Camera* instance = getInstance(state);
+                instance->setFieldOfView(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Camera_setNearPlane(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Camera* instance = getInstance(state);
+                instance->setNearPlane(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Camera_setZoomX(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Camera* instance = getInstance(state);
+                instance->setZoomX(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Camera_setZoomY(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                Camera* instance = getInstance(state);
+                instance->setZoomY(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Camera_static_createOrthographic(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 5:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 1);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 5 off the stack.
+                float param5 = (float)luaL_checknumber(state, 5);
+
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)Camera::createOrthographic(param1, param2, param3, param4, param5);
+                object->owns = false;
+                luaL_getmetatable(state, "Camera");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 5).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Camera_static_createPerspective(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 4:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 1);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 4);
+
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)Camera::createPerspective(param1, param2, param3, param4);
+                object->owns = false;
+                luaL_getmetatable(state, "Camera");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Camera_unproject(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 6:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 5 off the stack.
+                void* userdata6 = ScriptController::getInstance()->getObjectPointer(6, "Vector3");
+                if (!userdata6)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector3' for parameter 6.");
+                    lua_error(state);
+                }
+                Vector3* param5 = (Vector3*)((ScriptController::LuaObject*)userdata6)->instance;
+
+                Camera* instance = getInstance(state);
+                instance->unproject(*param1, param2, param3, param4, param5);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 6).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+}

+ 42 - 0
gameplay/src/lua/lua_Camera.h

@@ -0,0 +1,42 @@
+#ifndef LUA_CAMERA_H_
+#define LUA_CAMERA_H_
+
+namespace gameplay
+{
+
+// Lua bindings for Camera.
+int lua_Camera__gc(lua_State* state);
+int lua_Camera_addRef(lua_State* state);
+int lua_Camera_getAspectRatio(lua_State* state);
+int lua_Camera_getCameraType(lua_State* state);
+int lua_Camera_getFarPlane(lua_State* state);
+int lua_Camera_getFieldOfView(lua_State* state);
+int lua_Camera_getFrustum(lua_State* state);
+int lua_Camera_getInverseViewMatrix(lua_State* state);
+int lua_Camera_getInverseViewProjectionMatrix(lua_State* state);
+int lua_Camera_getNearPlane(lua_State* state);
+int lua_Camera_getNode(lua_State* state);
+int lua_Camera_getProjectionMatrix(lua_State* state);
+int lua_Camera_getRefCount(lua_State* state);
+int lua_Camera_getViewMatrix(lua_State* state);
+int lua_Camera_getViewProjectionMatrix(lua_State* state);
+int lua_Camera_getZoomX(lua_State* state);
+int lua_Camera_getZoomY(lua_State* state);
+int lua_Camera_pickRay(lua_State* state);
+int lua_Camera_project(lua_State* state);
+int lua_Camera_release(lua_State* state);
+int lua_Camera_setAspectRatio(lua_State* state);
+int lua_Camera_setFarPlane(lua_State* state);
+int lua_Camera_setFieldOfView(lua_State* state);
+int lua_Camera_setNearPlane(lua_State* state);
+int lua_Camera_setZoomX(lua_State* state);
+int lua_Camera_setZoomY(lua_State* state);
+int lua_Camera_static_createOrthographic(lua_State* state);
+int lua_Camera_static_createPerspective(lua_State* state);
+int lua_Camera_unproject(lua_State* state);
+
+void luaRegister_Camera();
+
+}
+
+#endif

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

@@ -0,0 +1,4183 @@
+#include "Base.h"
+#include "ScriptController.h"
+#include "CheckBox.h"
+#include "lua_CheckBox.h"
+#include "lua_Global.h"
+
+namespace gameplay
+{
+
+void luaRegister_CheckBox()
+{
+    ScriptController* sc = ScriptController::getInstance();
+
+    const luaL_Reg lua_members[] = 
+    {
+        {"addListener", lua_CheckBox_addListener},
+        {"addRef", lua_CheckBox_addRef},
+        {"createAnimation", lua_CheckBox_createAnimation},
+        {"createAnimationFromBy", lua_CheckBox_createAnimationFromBy},
+        {"createAnimationFromTo", lua_CheckBox_createAnimationFromTo},
+        {"destroyAnimation", lua_CheckBox_destroyAnimation},
+        {"disable", lua_CheckBox_disable},
+        {"enable", lua_CheckBox_enable},
+        {"getAlignment", lua_CheckBox_getAlignment},
+        {"getAnimation", lua_CheckBox_getAnimation},
+        {"getAnimationPropertyComponentCount", lua_CheckBox_getAnimationPropertyComponentCount},
+        {"getAnimationPropertyValue", lua_CheckBox_getAnimationPropertyValue},
+        {"getAutoHeight", lua_CheckBox_getAutoHeight},
+        {"getAutoWidth", lua_CheckBox_getAutoWidth},
+        {"getBorder", lua_CheckBox_getBorder},
+        {"getBounds", lua_CheckBox_getBounds},
+        {"getClip", lua_CheckBox_getClip},
+        {"getClipBounds", lua_CheckBox_getClipBounds},
+        {"getConsumeTouchEvents", lua_CheckBox_getConsumeTouchEvents},
+        {"getCursorColor", lua_CheckBox_getCursorColor},
+        {"getCursorRegion", lua_CheckBox_getCursorRegion},
+        {"getCursorUVs", lua_CheckBox_getCursorUVs},
+        {"getFont", lua_CheckBox_getFont},
+        {"getFontSize", lua_CheckBox_getFontSize},
+        {"getHeight", lua_CheckBox_getHeight},
+        {"getID", lua_CheckBox_getID},
+        {"getImageColor", lua_CheckBox_getImageColor},
+        {"getImageRegion", lua_CheckBox_getImageRegion},
+        {"getImageSize", lua_CheckBox_getImageSize},
+        {"getImageUVs", lua_CheckBox_getImageUVs},
+        {"getMargin", lua_CheckBox_getMargin},
+        {"getOpacity", lua_CheckBox_getOpacity},
+        {"getPadding", lua_CheckBox_getPadding},
+        {"getRefCount", lua_CheckBox_getRefCount},
+        {"getSkinColor", lua_CheckBox_getSkinColor},
+        {"getSkinRegion", lua_CheckBox_getSkinRegion},
+        {"getState", lua_CheckBox_getState},
+        {"getStyle", lua_CheckBox_getStyle},
+        {"getText", lua_CheckBox_getText},
+        {"getTextAlignment", lua_CheckBox_getTextAlignment},
+        {"getTextColor", lua_CheckBox_getTextColor},
+        {"getTextRightToLeft", lua_CheckBox_getTextRightToLeft},
+        {"getWidth", lua_CheckBox_getWidth},
+        {"getX", lua_CheckBox_getX},
+        {"getY", lua_CheckBox_getY},
+        {"getZIndex", lua_CheckBox_getZIndex},
+        {"isChecked", lua_CheckBox_isChecked},
+        {"isEnabled", lua_CheckBox_isEnabled},
+        {"release", lua_CheckBox_release},
+        {"setAlignment", lua_CheckBox_setAlignment},
+        {"setAnimationPropertyValue", lua_CheckBox_setAnimationPropertyValue},
+        {"setAutoHeight", lua_CheckBox_setAutoHeight},
+        {"setAutoWidth", lua_CheckBox_setAutoWidth},
+        {"setBorder", lua_CheckBox_setBorder},
+        {"setBounds", lua_CheckBox_setBounds},
+        {"setChecked", lua_CheckBox_setChecked},
+        {"setConsumeTouchEvents", lua_CheckBox_setConsumeTouchEvents},
+        {"setCursorColor", lua_CheckBox_setCursorColor},
+        {"setCursorRegion", lua_CheckBox_setCursorRegion},
+        {"setFont", lua_CheckBox_setFont},
+        {"setFontSize", lua_CheckBox_setFontSize},
+        {"setImageColor", lua_CheckBox_setImageColor},
+        {"setImageRegion", lua_CheckBox_setImageRegion},
+        {"setImageSize", lua_CheckBox_setImageSize},
+        {"setMargin", lua_CheckBox_setMargin},
+        {"setOpacity", lua_CheckBox_setOpacity},
+        {"setPadding", lua_CheckBox_setPadding},
+        {"setPosition", lua_CheckBox_setPosition},
+        {"setSize", lua_CheckBox_setSize},
+        {"setSkinColor", lua_CheckBox_setSkinColor},
+        {"setSkinRegion", lua_CheckBox_setSkinRegion},
+        {"setState", lua_CheckBox_setState},
+        {"setStyle", lua_CheckBox_setStyle},
+        {"setText", lua_CheckBox_setText},
+        {"setTextAlignment", lua_CheckBox_setTextAlignment},
+        {"setTextColor", lua_CheckBox_setTextColor},
+        {"setTextRightToLeft", lua_CheckBox_setTextRightToLeft},
+        {"setZIndex", lua_CheckBox_setZIndex},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"ANIMATE_OPACITY", lua_CheckBox_static_ANIMATE_OPACITY},
+        {"ANIMATE_POSITION", lua_CheckBox_static_ANIMATE_POSITION},
+        {"ANIMATE_POSITION_X", lua_CheckBox_static_ANIMATE_POSITION_X},
+        {"ANIMATE_POSITION_Y", lua_CheckBox_static_ANIMATE_POSITION_Y},
+        {"ANIMATE_SIZE", lua_CheckBox_static_ANIMATE_SIZE},
+        {"ANIMATE_SIZE_HEIGHT", lua_CheckBox_static_ANIMATE_SIZE_HEIGHT},
+        {"ANIMATE_SIZE_WIDTH", lua_CheckBox_static_ANIMATE_SIZE_WIDTH},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    sc->registerClass("CheckBox", lua_members, NULL, lua_CheckBox__gc, lua_statics, scopePath);
+}
+
+static CheckBox* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "CheckBox");
+    luaL_argcheck(state, userdata != NULL, 1, "'CheckBox' expected.");
+    return (CheckBox*)((ScriptController::LuaObject*)userdata)->instance;
+}
+
+int lua_CheckBox__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, "CheckBox");
+                luaL_argcheck(state, userdata != NULL, 1, "'CheckBox' expected.");
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    CheckBox* instance = (CheckBox*)object->instance;
+                    SAFE_RELEASE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_addListener(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_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "ControlListener");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Control::Listener' for parameter 2.");
+                    lua_error(state);
+                }
+                Control::Listener* param1 = (Control::Listener*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->addListener(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_addRef(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)
+            {
+                CheckBox* instance = getInstance(state);
+                instance->addRef();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_createAnimation(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, 3) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                const char* param2 = luaL_checkstring(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Properties");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Properties' for parameter 3.");
+                    lua_error(state);
+                }
+                Properties* param2 = (Properties*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 7:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 7) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
+
+                // Get parameter 4 off the stack.
+                unsigned long* param4 = ScriptController::getInstance()->getUnsignedLongPointer(5);
+
+                // Get parameter 5 off the stack.
+                float* param5 = ScriptController::getInstance()->getFloatPointer(6);
+
+                // Get parameter 6 off the stack.
+                Curve::InterpolationType param6 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 7));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 9:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 8) == LUA_TTABLE || lua_type(state, 8) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 9) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
+
+                // Get parameter 4 off the stack.
+                unsigned long* param4 = ScriptController::getInstance()->getUnsignedLongPointer(5);
+
+                // Get parameter 5 off the stack.
+                float* param5 = ScriptController::getInstance()->getFloatPointer(6);
+
+                // Get parameter 6 off the stack.
+                float* param6 = ScriptController::getInstance()->getFloatPointer(7);
+
+                // Get parameter 7 off the stack.
+                float* param7 = ScriptController::getInstance()->getFloatPointer(8);
+
+                // Get parameter 8 off the stack.
+                Curve::InterpolationType param8 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 9));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6, param7, param8);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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, 7 or 9).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_createAnimationFromBy(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 7:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 6) == LUA_TSTRING &&
+                lua_type(state, 7) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                float* param3 = ScriptController::getInstance()->getFloatPointer(4);
+
+                // Get parameter 4 off the stack.
+                float* param4 = ScriptController::getInstance()->getFloatPointer(5);
+
+                // Get parameter 5 off the stack.
+                Curve::InterpolationType param5 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 6));
+
+                // Get parameter 6 off the stack.
+                unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimationFromBy(param1, param2, param3, param4, param5, param6);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 7).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_createAnimationFromTo(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 7:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
+                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                lua_type(state, 6) == LUA_TSTRING &&
+                lua_type(state, 7) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                // Get parameter 3 off the stack.
+                float* param3 = ScriptController::getInstance()->getFloatPointer(4);
+
+                // Get parameter 4 off the stack.
+                float* param4 = ScriptController::getInstance()->getFloatPointer(5);
+
+                // Get parameter 5 off the stack.
+                Curve::InterpolationType param5 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 6));
+
+                // Get parameter 6 off the stack.
+                unsigned long param6 = (unsigned long)luaL_checkunsigned(state, 7);
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->createAnimationFromTo(param1, param2, param3, param4, param5, param6);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 7).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_destroyAnimation(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)
+            {
+                CheckBox* instance = getInstance(state);
+                instance->destroyAnimation();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                CheckBox* instance = getInstance(state);
+                instance->destroyAnimation(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_disable(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)
+            {
+                CheckBox* instance = getInstance(state);
+                instance->disable();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_enable(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)
+            {
+                CheckBox* instance = getInstance(state);
+                instance->enable();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getAlignment(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)
+            {
+                CheckBox* instance = getInstance(state);
+                Control::Alignment result = instance->getAlignment();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_ControlAlignment(result).c_str());
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getAnimation(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getAnimation();
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getAnimation(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "Animation");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getAnimationPropertyComponentCount(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                CheckBox* instance = getInstance(state);
+                unsigned int result = instance->getAnimationPropertyComponentCount(param1);
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getAnimationPropertyValue(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
+                    lua_error(state);
+                }
+                AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                CheckBox* instance = getInstance(state);
+                instance->getAnimationPropertyValue(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_getAutoHeight(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)
+            {
+                CheckBox* instance = getInstance(state);
+                bool result = instance->getAutoHeight();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getAutoWidth(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)
+            {
+                CheckBox* instance = getInstance(state);
+                bool result = instance->getAutoWidth();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getBorder(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getBorder());
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeSideRegions");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getBorder(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeSideRegions");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getBounds(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getBounds());
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getClip(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getClip());
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getClipBounds(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getClipBounds());
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getConsumeTouchEvents(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)
+            {
+                CheckBox* instance = getInstance(state);
+                bool result = instance->getConsumeTouchEvents();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getCursorColor(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getCursorColor(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getCursorRegion(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getCursorRegion(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getCursorUVs(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getCursorUVs(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeUVs");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getFont(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getFont();
+                object->owns = false;
+                luaL_getmetatable(state, "Font");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getFont(param1);
+                object->owns = false;
+                luaL_getmetatable(state, "Font");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getFontSize(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)
+            {
+                CheckBox* instance = getInstance(state);
+                unsigned int result = instance->getFontSize();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                unsigned int result = instance->getFontSize(param1);
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getHeight(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)
+            {
+                CheckBox* instance = getInstance(state);
+                float result = instance->getHeight();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getID(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)
+            {
+                CheckBox* instance = getInstance(state);
+                const char* result = instance->getID();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getImageColor(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, 3) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                Control::State param2 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 3));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getImageColor(param1, param2));
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_getImageRegion(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, 3) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                Control::State param2 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 3));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getImageRegion(param1, param2));
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_getImageSize(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getImageSize());
+                object->owns = false;
+                luaL_getmetatable(state, "Vector2");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getImageUVs(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, 3) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                Control::State param2 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 3));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getImageUVs(param1, param2));
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeUVs");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_getMargin(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getMargin());
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeSideRegions");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getOpacity(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)
+            {
+                CheckBox* instance = getInstance(state);
+                float result = instance->getOpacity();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                float result = instance->getOpacity(param1);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getPadding(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getPadding());
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeSideRegions");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getRefCount(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)
+            {
+                CheckBox* instance = getInstance(state);
+                unsigned int result = instance->getRefCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getSkinColor(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getSkinColor());
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getSkinColor(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getSkinRegion(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getSkinRegion());
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getSkinRegion(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "Rectangle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getState(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)
+            {
+                CheckBox* instance = getInstance(state);
+                Control::State result = instance->getState();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_ControlState(result).c_str());
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getStyle(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)instance->getStyle();
+                object->owns = false;
+                luaL_getmetatable(state, "ThemeStyle");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getText(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)
+            {
+                CheckBox* instance = getInstance(state);
+                const char* result = instance->getText();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getTextAlignment(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)
+            {
+                CheckBox* instance = getInstance(state);
+                Font::Justify result = instance->getTextAlignment();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_FontJustify(result).c_str());
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                Font::Justify result = instance->getTextAlignment(param1);
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_FontJustify(result).c_str());
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getTextColor(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)
+            {
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getTextColor());
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
+                object->instance = (void*)&(instance->getTextColor(param1));
+                object->owns = false;
+                luaL_getmetatable(state, "Vector4");
+                lua_setmetatable(state, -2);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getTextRightToLeft(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)
+            {
+                CheckBox* instance = getInstance(state);
+                bool result = instance->getTextRightToLeft();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                bool result = instance->getTextRightToLeft(param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_getWidth(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)
+            {
+                CheckBox* instance = getInstance(state);
+                float result = instance->getWidth();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getX(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)
+            {
+                CheckBox* instance = getInstance(state);
+                float result = instance->getX();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getY(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)
+            {
+                CheckBox* instance = getInstance(state);
+                float result = instance->getY();
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_getZIndex(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)
+            {
+                CheckBox* instance = getInstance(state);
+                int result = instance->getZIndex();
+
+                // Push the return value onto the stack.
+                lua_pushinteger(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_isChecked(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)
+            {
+                CheckBox* instance = getInstance(state);
+                bool result = instance->isChecked();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_isEnabled(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)
+            {
+                CheckBox* instance = getInstance(state);
+                bool result = instance->isEnabled();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_release(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)
+            {
+                CheckBox* instance = getInstance(state);
+                instance->release();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_CheckBox_setAlignment(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::Alignment param1 = (Control::Alignment)lua_enumFromString_ControlAlignment(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                instance->setAlignment(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setAnimationPropertyValue(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
+                    lua_error(state);
+                }
+                AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                CheckBox* instance = getInstance(state);
+                instance->setAnimationPropertyValue(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 4:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TUSERDATA &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "AnimationValue");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'AnimationValue' for parameter 3.");
+                    lua_error(state);
+                }
+                AnimationValue* param2 = (AnimationValue*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                CheckBox* instance = getInstance(state);
+                instance->setAnimationPropertyValue(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setAutoHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                CheckBox* instance = getInstance(state);
+                instance->setAutoHeight(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setAutoWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                CheckBox* instance = getInstance(state);
+                instance->setAutoWidth(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setBorder(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 5:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                CheckBox* instance = getInstance(state);
+                instance->setBorder(param1, param2, param3, param4);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 6:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER &&
+                lua_type(state, 6) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                // Get parameter 5 off the stack.
+                unsigned char param5 = (unsigned char)luaL_checkunsigned(state, 6);
+
+                CheckBox* instance = getInstance(state);
+                instance->setBorder(param1, param2, param3, param4, param5);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 5 or 6).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setBounds(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                CheckBox* instance = getInstance(state);
+                instance->setBounds(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setChecked(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                CheckBox* instance = getInstance(state);
+                instance->setChecked(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setConsumeTouchEvents(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                CheckBox* instance = getInstance(state);
+                instance->setConsumeTouchEvents(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setCursorColor(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_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setCursorColor(*param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_setCursorRegion(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_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setCursorRegion(*param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_setFont(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Font");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Font' for parameter 2.");
+                    lua_error(state);
+                }
+                Font* param1 = (Font*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                CheckBox* instance = getInstance(state);
+                instance->setFont(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Font");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Font' for parameter 2.");
+                    lua_error(state);
+                }
+                Font* param1 = (Font*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setFont(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setFontSize(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                CheckBox* instance = getInstance(state);
+                instance->setFontSize(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setFontSize(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setImageColor(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, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Vector4");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 3.");
+                    lua_error(state);
+                }
+                Vector4* param2 = (Vector4*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                CheckBox* instance = getInstance(state);
+                instance->setImageColor(param1, *param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 4:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TUSERDATA &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Vector4");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 3.");
+                    lua_error(state);
+                }
+                Vector4* param2 = (Vector4*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                // Get parameter 3 off the stack.
+                unsigned char param3 = (unsigned char)luaL_checkunsigned(state, 4);
+
+                CheckBox* instance = getInstance(state);
+                instance->setImageColor(param1, *param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setImageRegion(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, 3) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Rectangle");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 3.");
+                    lua_error(state);
+                }
+                Rectangle* param2 = (Rectangle*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                CheckBox* instance = getInstance(state);
+                instance->setImageRegion(param1, *param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 4:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TUSERDATA &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                // Get parameter 2 off the stack.
+                void* userdata3 = ScriptController::getInstance()->getObjectPointer(3, "Rectangle");
+                if (!userdata3)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 3.");
+                    lua_error(state);
+                }
+                Rectangle* param2 = (Rectangle*)((ScriptController::LuaObject*)userdata3)->instance;
+
+                // Get parameter 3 off the stack.
+                unsigned char param3 = (unsigned char)luaL_checkunsigned(state, 4);
+
+                CheckBox* instance = getInstance(state);
+                instance->setImageRegion(param1, *param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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 or 4).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setImageSize(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setImageSize(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_setMargin(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 5:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                CheckBox* instance = getInstance(state);
+                instance->setMargin(param1, param2, param3, param4);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 5).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setOpacity(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                CheckBox* instance = getInstance(state);
+                instance->setOpacity(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setOpacity(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setPadding(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 5:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER &&
+                lua_type(state, 4) == LUA_TNUMBER &&
+                lua_type(state, 5) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                // Get parameter 4 off the stack.
+                float param4 = (float)luaL_checknumber(state, 5);
+
+                CheckBox* instance = getInstance(state);
+                instance->setPadding(param1, param2, param3, param4);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 5).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setPosition(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setPosition(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_setSize(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_TNUMBER &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                float param1 = (float)luaL_checknumber(state, 2);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setSize(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "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_setSkinColor(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                CheckBox* instance = getInstance(state);
+                instance->setSkinColor(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setSkinColor(*param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setSkinRegion(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                CheckBox* instance = getInstance(state);
+                instance->setSkinRegion(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Rectangle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Rectangle' for parameter 2.");
+                    lua_error(state);
+                }
+                Rectangle* param1 = (Rectangle*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setSkinRegion(*param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setState(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Control::State param1 = (Control::State)lua_enumFromString_ControlState(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                instance->setState(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setStyle(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "ThemeStyle");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Theme::Style' for parameter 2.");
+                    lua_error(state);
+                }
+                Theme::Style* param1 = (Theme::Style*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                CheckBox* instance = getInstance(state);
+                instance->setStyle(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setText(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = luaL_checkstring(state, 2);
+
+                CheckBox* instance = getInstance(state);
+                instance->setText(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setTextAlignment(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING)
+            {
+                // Get parameter 1 off the stack.
+                Font::Justify param1 = (Font::Justify)lua_enumFromString_FontJustify(luaL_checkstring(state, 2));
+
+                CheckBox* instance = getInstance(state);
+                instance->setTextAlignment(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TSTRING &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                Font::Justify param1 = (Font::Justify)lua_enumFromString_FontJustify(luaL_checkstring(state, 2));
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setTextAlignment(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setTextColor(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                CheckBox* instance = getInstance(state);
+                instance->setTextColor(*param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TUSERDATA &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                void* userdata2 = ScriptController::getInstance()->getObjectPointer(2, "Vector4");
+                if (!userdata2)
+                {
+                    lua_pushstring(state, "Failed to retrieve a valid object pointer of type 'Vector4' for parameter 2.");
+                    lua_error(state);
+                }
+                Vector4* param1 = (Vector4*)((ScriptController::LuaObject*)userdata2)->instance;
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setTextColor(*param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setTextRightToLeft(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                CheckBox* instance = getInstance(state);
+                instance->setTextRightToLeft(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        case 3:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TBOOLEAN &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                bool param1 = (luaL_checkint(state, 2) != 0);
+
+                // Get parameter 2 off the stack.
+                unsigned char param2 = (unsigned char)luaL_checkunsigned(state, 3);
+
+                CheckBox* instance = getInstance(state);
+                instance->setTextRightToLeft(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2 or 3).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_setZIndex(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if (lua_type(state, 1) == LUA_TUSERDATA &&
+                lua_type(state, 2) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                int param1 = (int)luaL_checkint(state, 2);
+
+                CheckBox* instance = getInstance(state);
+                instance->setZIndex(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_CheckBox_static_ANIMATE_OPACITY(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = CheckBox::ANIMATE_OPACITY;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_CheckBox_static_ANIMATE_POSITION(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = CheckBox::ANIMATE_POSITION;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_CheckBox_static_ANIMATE_POSITION_X(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = CheckBox::ANIMATE_POSITION_X;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_CheckBox_static_ANIMATE_POSITION_Y(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = CheckBox::ANIMATE_POSITION_Y;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_CheckBox_static_ANIMATE_SIZE(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = CheckBox::ANIMATE_SIZE;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_CheckBox_static_ANIMATE_SIZE_HEIGHT(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = CheckBox::ANIMATE_SIZE_HEIGHT;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+int lua_CheckBox_static_ANIMATE_SIZE_WIDTH(lua_State* state)
+{
+    // Validate the number of parameters.
+    if (lua_gettop(state) > 0)
+    {
+        lua_pushstring(state, "Invalid number of parameters (expected 0).");
+        lua_error(state);
+    }
+
+    int result = CheckBox::ANIMATE_SIZE_WIDTH;
+
+    // Push the return value onto the stack.
+    lua_pushinteger(state, result);
+
+    return 1;
+}
+
+}

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

@@ -0,0 +1,99 @@
+#ifndef LUA_CHECKBOX_H_
+#define LUA_CHECKBOX_H_
+
+namespace gameplay
+{
+
+// Lua bindings for CheckBox.
+int lua_CheckBox__gc(lua_State* state);
+int lua_CheckBox_addListener(lua_State* state);
+int lua_CheckBox_addRef(lua_State* state);
+int lua_CheckBox_createAnimation(lua_State* state);
+int lua_CheckBox_createAnimationFromBy(lua_State* state);
+int lua_CheckBox_createAnimationFromTo(lua_State* state);
+int lua_CheckBox_destroyAnimation(lua_State* state);
+int lua_CheckBox_disable(lua_State* state);
+int lua_CheckBox_enable(lua_State* state);
+int lua_CheckBox_getAlignment(lua_State* state);
+int lua_CheckBox_getAnimation(lua_State* state);
+int lua_CheckBox_getAnimationPropertyComponentCount(lua_State* state);
+int lua_CheckBox_getAnimationPropertyValue(lua_State* state);
+int lua_CheckBox_getAutoHeight(lua_State* state);
+int lua_CheckBox_getAutoWidth(lua_State* state);
+int lua_CheckBox_getBorder(lua_State* state);
+int lua_CheckBox_getBounds(lua_State* state);
+int lua_CheckBox_getClip(lua_State* state);
+int lua_CheckBox_getClipBounds(lua_State* state);
+int lua_CheckBox_getConsumeTouchEvents(lua_State* state);
+int lua_CheckBox_getCursorColor(lua_State* state);
+int lua_CheckBox_getCursorRegion(lua_State* state);
+int lua_CheckBox_getCursorUVs(lua_State* state);
+int lua_CheckBox_getFont(lua_State* state);
+int lua_CheckBox_getFontSize(lua_State* state);
+int lua_CheckBox_getHeight(lua_State* state);
+int lua_CheckBox_getID(lua_State* state);
+int lua_CheckBox_getImageColor(lua_State* state);
+int lua_CheckBox_getImageRegion(lua_State* state);
+int lua_CheckBox_getImageSize(lua_State* state);
+int lua_CheckBox_getImageUVs(lua_State* state);
+int lua_CheckBox_getMargin(lua_State* state);
+int lua_CheckBox_getOpacity(lua_State* state);
+int lua_CheckBox_getPadding(lua_State* state);
+int lua_CheckBox_getRefCount(lua_State* state);
+int lua_CheckBox_getSkinColor(lua_State* state);
+int lua_CheckBox_getSkinRegion(lua_State* state);
+int lua_CheckBox_getState(lua_State* state);
+int lua_CheckBox_getStyle(lua_State* state);
+int lua_CheckBox_getText(lua_State* state);
+int lua_CheckBox_getTextAlignment(lua_State* state);
+int lua_CheckBox_getTextColor(lua_State* state);
+int lua_CheckBox_getTextRightToLeft(lua_State* state);
+int lua_CheckBox_getWidth(lua_State* state);
+int lua_CheckBox_getX(lua_State* state);
+int lua_CheckBox_getY(lua_State* state);
+int lua_CheckBox_getZIndex(lua_State* state);
+int lua_CheckBox_isChecked(lua_State* state);
+int lua_CheckBox_isEnabled(lua_State* state);
+int lua_CheckBox_release(lua_State* state);
+int lua_CheckBox_setAlignment(lua_State* state);
+int lua_CheckBox_setAnimationPropertyValue(lua_State* state);
+int lua_CheckBox_setAutoHeight(lua_State* state);
+int lua_CheckBox_setAutoWidth(lua_State* state);
+int lua_CheckBox_setBorder(lua_State* state);
+int lua_CheckBox_setBounds(lua_State* state);
+int lua_CheckBox_setChecked(lua_State* state);
+int lua_CheckBox_setConsumeTouchEvents(lua_State* state);
+int lua_CheckBox_setCursorColor(lua_State* state);
+int lua_CheckBox_setCursorRegion(lua_State* state);
+int lua_CheckBox_setFont(lua_State* state);
+int lua_CheckBox_setFontSize(lua_State* state);
+int lua_CheckBox_setImageColor(lua_State* state);
+int lua_CheckBox_setImageRegion(lua_State* state);
+int lua_CheckBox_setImageSize(lua_State* state);
+int lua_CheckBox_setMargin(lua_State* state);
+int lua_CheckBox_setOpacity(lua_State* state);
+int lua_CheckBox_setPadding(lua_State* state);
+int lua_CheckBox_setPosition(lua_State* state);
+int lua_CheckBox_setSize(lua_State* state);
+int lua_CheckBox_setSkinColor(lua_State* state);
+int lua_CheckBox_setSkinRegion(lua_State* state);
+int lua_CheckBox_setState(lua_State* state);
+int lua_CheckBox_setStyle(lua_State* state);
+int lua_CheckBox_setText(lua_State* state);
+int lua_CheckBox_setTextAlignment(lua_State* state);
+int lua_CheckBox_setTextColor(lua_State* state);
+int lua_CheckBox_setTextRightToLeft(lua_State* state);
+int lua_CheckBox_setZIndex(lua_State* state);
+int lua_CheckBox_static_ANIMATE_OPACITY(lua_State* state);
+int lua_CheckBox_static_ANIMATE_POSITION(lua_State* state);
+int lua_CheckBox_static_ANIMATE_POSITION_X(lua_State* state);
+int lua_CheckBox_static_ANIMATE_POSITION_Y(lua_State* state);
+int lua_CheckBox_static_ANIMATE_SIZE(lua_State* state);
+int lua_CheckBox_static_ANIMATE_SIZE_HEIGHT(lua_State* state);
+int lua_CheckBox_static_ANIMATE_SIZE_WIDTH(lua_State* state);
+
+void luaRegister_CheckBox();
+
+}
+
+#endif

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio