Jelajahi Sumber

Merge pull request #547 from blackberry-gaming/next-cculy

Next cculy
Sean Paul Taylor 13 tahun lalu
induk
melakukan
459ec4407d
91 mengubah file dengan 2913 tambahan dan 3245 penghapusan
  1. 1 0
      .gitignore
  2. 5 8
      gameplay-luagen/README.md
  3. 24 2
      gameplay-luagen/gameplay-luagen.vcxproj
  4. 2 0
      gameplay-luagen/gameplay-luagen.vcxproj.user
  5. 42 29
      gameplay-luagen/src/Generator.cpp
  6. 1 0
      gameplay-luagen/src/Generator.h
  7. 0 4
      gameplay/gameplay.vcxproj
  8. 0 12
      gameplay/gameplay.vcxproj.filters
  9. 2 0
      gameplay/src/AudioSource.h
  10. 5 0
      gameplay/src/Bundle.h
  11. 1 0
      gameplay/src/CheckBox.h
  12. 1 0
      gameplay/src/Container.h
  13. 1 0
      gameplay/src/Curve.h
  14. 1 0
      gameplay/src/DepthStencilTarget.h
  15. 40 39
      gameplay/src/Font.h
  16. 2 0
      gameplay/src/Form.h
  17. 1 0
      gameplay/src/FrameBuffer.h
  18. 1 0
      gameplay/src/Image.h
  19. 1 0
      gameplay/src/Joystick.h
  20. 1 0
      gameplay/src/Label.h
  21. 4 0
      gameplay/src/Material.h
  22. 2 0
      gameplay/src/MeshBatch.h
  23. 1 0
      gameplay/src/Model.h
  24. 1 0
      gameplay/src/Node.h
  25. 3 0
      gameplay/src/ParticleEmitter.h
  26. 1 0
      gameplay/src/Properties.h
  27. 1 0
      gameplay/src/RadioButton.h
  28. 1 0
      gameplay/src/RenderState.h
  29. 1 0
      gameplay/src/RenderTarget.h
  30. 1 0
      gameplay/src/SceneLoader.h
  31. 7 0
      gameplay/src/ScriptController.cpp
  32. 1 0
      gameplay/src/Slider.h
  33. 2 0
      gameplay/src/SpriteBatch.h
  34. 1 0
      gameplay/src/TextBox.h
  35. 5 0
      gameplay/src/Texture.h
  36. 1 0
      gameplay/src/Theme.h
  37. 1 0
      gameplay/src/VertexAttributeBinding.h
  38. 1 0
      gameplay/src/VerticalLayout.h
  39. 469 469
      gameplay/src/lua/lua_AIAgent.cpp
  40. 24 24
      gameplay/src/lua/lua_AIAgent.h
  41. 115 115
      gameplay/src/lua/lua_AIAgentListener.cpp
  42. 15 15
      gameplay/src/lua/lua_AIAgentListener.h
  43. 144 144
      gameplay/src/lua/lua_AIController.cpp
  44. 15 15
      gameplay/src/lua/lua_AIController.h
  45. 838 838
      gameplay/src/lua/lua_AIMessage.cpp
  46. 32 32
      gameplay/src/lua/lua_AIMessage.h
  47. 58 58
      gameplay/src/lua/lua_AIMessageParameterType.cpp
  48. 15 15
      gameplay/src/lua/lua_AIMessageParameterType.h
  49. 309 309
      gameplay/src/lua/lua_AIState.cpp
  50. 20 20
      gameplay/src/lua/lua_AIState.h
  51. 243 243
      gameplay/src/lua/lua_AIStateListener.cpp
  52. 18 18
      gameplay/src/lua/lua_AIStateListener.h
  53. 343 343
      gameplay/src/lua/lua_AIStateMachine.cpp
  54. 19 19
      gameplay/src/lua/lua_AIStateMachine.h
  55. 2 2
      gameplay/src/lua/lua_AudioSource.cpp
  56. 6 6
      gameplay/src/lua/lua_Bundle.cpp
  57. 1 1
      gameplay/src/lua/lua_CheckBox.cpp
  58. 2 2
      gameplay/src/lua/lua_Container.cpp
  59. 1 1
      gameplay/src/lua/lua_Curve.cpp
  60. 1 1
      gameplay/src/lua/lua_DepthStencilTarget.cpp
  61. 3 54
      gameplay/src/lua/lua_Font.cpp
  62. 0 202
      gameplay/src/lua/lua_FontGlyph.cpp
  63. 0 18
      gameplay/src/lua/lua_FontGlyph.h
  64. 0 1
      gameplay/src/lua/lua_FontText.cpp
  65. 3 3
      gameplay/src/lua/lua_Form.cpp
  66. 1 1
      gameplay/src/lua/lua_FrameBuffer.cpp
  67. 5 10
      gameplay/src/lua/lua_Global.cpp
  68. 1 1
      gameplay/src/lua/lua_Image.cpp
  69. 1 1
      gameplay/src/lua/lua_Joystick.cpp
  70. 1 1
      gameplay/src/lua/lua_Label.cpp
  71. 5 5
      gameplay/src/lua/lua_Material.cpp
  72. 6 6
      gameplay/src/lua/lua_MeshBatch.cpp
  73. 1 1
      gameplay/src/lua/lua_Model.cpp
  74. 2 2
      gameplay/src/lua/lua_Node.cpp
  75. 3 3
      gameplay/src/lua/lua_ParticleEmitter.cpp
  76. 1 1
      gameplay/src/lua/lua_Properties.cpp
  77. 1 1
      gameplay/src/lua/lua_RadioButton.cpp
  78. 1 1
      gameplay/src/lua/lua_RenderStateStateBlock.cpp
  79. 1 1
      gameplay/src/lua/lua_RenderTarget.cpp
  80. 0 109
      gameplay/src/lua/lua_SceneLoader.cpp
  81. 0 15
      gameplay/src/lua/lua_SceneLoader.h
  82. 1 1
      gameplay/src/lua/lua_Slider.cpp
  83. 6 6
      gameplay/src/lua/lua_SpriteBatch.cpp
  84. 1 1
      gameplay/src/lua/lua_TextBox.cpp
  85. 6 6
      gameplay/src/lua/lua_Texture.cpp
  86. 3 3
      gameplay/src/lua/lua_TextureSampler.cpp
  87. 1 1
      gameplay/src/lua/lua_Theme.cpp
  88. 1 1
      gameplay/src/lua/lua_VertexAttributeBinding.cpp
  89. 1 1
      gameplay/src/lua/lua_VerticalLayout.cpp
  90. 0 2
      gameplay/src/lua/lua_all_bindings.cpp
  91. 0 2
      gameplay/src/lua/lua_all_bindings.h

+ 1 - 0
.gitignore

@@ -197,3 +197,4 @@ Thumbs.db
 /gameplay-samples/sample05-lua/android/project.properties
 
 /gameplay-internal
+/gameplay\android/proguard-project.txt

+ 5 - 8
gameplay-luagen/README.md

@@ -31,23 +31,20 @@ There are also prebuilt binaries in the gameplay/bin folder.
     end
 - Note: you can't pass an enum to a function that doesn't explicitly take an enum (i.e. Control::setTextColor, which takes an unsigned char). In these cases, you need to go look up the enum values and pass them directly.
 
+
 ## Unsupported Features
 - 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).
 
-### To Do List
-- Get Mac OS X and iOS working.
-- Fix hierarchy inheritance
-- Fix memory leaks in gameplay-luagen and in generated code.
-    * Add "@script{create}" to the appropriate gameplay functions.
-    * Add "@script{own}" to array parameters that are owned by the function or class they are passed to?
-- Add a global function that implements casting for use from Lua scripts (i.e. to downcast from a Control to a Button).
 
-### Future Feature List
+### To Do List
+- ScriptTarget class (remove ScriptListener class).
 - Add support for users to generate bindings for their own classes.
 - Look into updating bindValue() to support binding to any Lua script function.
+- Add a global function that implements casting for use from Lua scripts (i.e. to downcast from a Control to a Button).
+- Currently ignored: there is one memory leak in gameplay-luagen that is very difficult to fix (it appears to be a locale related leak-something leaks the first time an ofstream is created-doesn't matter the ofstream).
 
 
 ## Disclaimer

+ 24 - 2
gameplay-luagen/gameplay-luagen.vcxproj

@@ -55,9 +55,13 @@
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <LinkIncremental>true</LinkIncremental>
+    <CustomBuildBeforeTargets>
+    </CustomBuildBeforeTargets>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <LinkIncremental>false</LinkIncremental>
+    <CustomBuildBeforeTargets>
+    </CustomBuildBeforeTargets>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
@@ -76,8 +80,17 @@
       <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>
     <PreBuildEvent>
-      <Command>del /Q "$(ProjectDir)..\gameplay\src\lua\*"</Command>
+      <Command>
+      </Command>
     </PreBuildEvent>
+    <CustomBuildStep>
+      <Command>
+      </Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>
+      </Message>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
@@ -99,8 +112,17 @@
       <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>
     <PreBuildEvent>
-      <Command>del /Q "$(ProjectDir)..\gameplay\src\lua\*"</Command>
+      <Command>
+      </Command>
     </PreBuildEvent>
+    <CustomBuildStep>
+      <Command>
+      </Command>
+    </CustomBuildStep>
+    <CustomBuildStep>
+      <Message>
+      </Message>
+    </CustomBuildStep>
   </ItemDefinitionGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">

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

@@ -3,9 +3,11 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <LocalDebuggerCommandArguments>"$(ProjectDir)xml/" "$(ProjectDir)../gameplay/src/lua/"</LocalDebuggerCommandArguments>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+    <LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <LocalDebuggerCommandArguments>"$(ProjectDir)xml/" "$(ProjectDir)../gameplay/src/lua/"</LocalDebuggerCommandArguments>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+    <LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
   </PropertyGroup>
 </Project>

+ 42 - 29
gameplay-luagen/src/Generator.cpp

@@ -2,8 +2,6 @@
 
 Generator* Generator::__instance = NULL;
 
-set<string> __warnings;
-
 // Warning flags.
 static bool __printTemplateWarning = false;
 static bool __printVarargWarning = false;
@@ -14,6 +12,7 @@ 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 inline bool isGeneratedBindingFile(const string& s);
 static bool getFileList(string directory, vector<string>& files, bool (*isWantedFile)(const string& s));
 static bool isReservedKeyword(string name);
 
@@ -103,12 +102,17 @@ 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;
+        // If the derived class is not in the ref ID table, then it
+        // is a hidden (protected, private, etc.) class, so don't consider it.
+        if (_refIds.find(c.derived[i]) != _refIds.end())
+        {
+            const string& derivedClassName = getIdentifier(c.derived[i]);
+            if (derivedClassName == classname || 
+                (_classes.find(derivedClassName) != _classes.end() &&
+                isDerived(_classes[derivedClassName], classname)))
+            {
+                return true;
+            }
         }
     }
     return false;
@@ -151,6 +155,18 @@ void Generator::run(string inDir, string outDir)
     // Set the output directory.
     _outDir = outDir;
 
+    // Get a list of all .cpp and .h files in the output directory so
+    // we can delete them before generating new bindings.
+    vector<string> oldBindingsFiles;
+    getFileList(outDir, oldBindingsFiles, isGeneratedBindingFile);
+
+    // Delete the old bindings.
+    for (unsigned int i = 0; i < oldBindingsFiles.size(); i++)
+    {
+        remove(oldBindingsFiles[i].c_str());
+    }
+
+
     // Get a list of the Doxygen XML files that specify a namespace.
     // Note: we must do this before adding the normal files so that
     // when we process the files sequentially, we process the namespaces
@@ -370,10 +386,6 @@ void Generator::getNamespace(XMLElement* nsNode, const string& name)
 
 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");
 
@@ -383,6 +395,10 @@ void Generator::getClass(XMLElement* classNode, const string& name)
     // Store the mapping between the ref id and the class's fully qualified name.
     Generator::getInstance()->setIdentifier(refId, classBinding.classname);
 
+    // Check if we should ignore this class.
+    if (getScriptFlag(classNode) == "ignore")
+        return;
+
     // Get the include header for the original class declaration.
     XMLElement* includeElement = classNode->FirstChildElement("includes");
     if (includeElement)
@@ -857,7 +873,6 @@ string Generator::getScriptFlag(XMLElement* e)
     return flag;
 }
 
-
 void Generator::getCreateFlag(XMLElement* e, FunctionBinding& b)
 {
     if (getScriptFlag(e) == "create")
@@ -1495,11 +1510,6 @@ void Generator::generateBindings()
         {
             string path = _outDir + string(LUA_GLOBAL_FILENAME) + string(".h");
             ofstream global(path.c_str());
-            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";
@@ -1550,13 +1560,7 @@ void Generator::generateBindings()
         // Write out the implementation.
         {
             string path = _outDir + string(LUA_GLOBAL_FILENAME) + string(".cpp");
-            ofstream global(path.c_str());
-            if (!global)
-            {
-                GP_ERROR("Failed to open file '%s' for generating Lua bindings.", path.c_str());
-                goto end;
-            }
-            
+            ofstream global(path.c_str());            
             global << "#include \"ScriptController.h\"\n";
             global << "#include \"" << LUA_GLOBAL_FILENAME << ".h\"\n";
             map<string, set<string> >::iterator iter = _includes.find(string(LUA_GLOBAL_FILENAME) + string(".h"));
@@ -1658,7 +1662,6 @@ void Generator::generateBindings()
         }
     }
 
-end:
     luaAllCpp << "}\n\n";
     if (bindingNS)
         luaAllCpp << "}\n\n";
@@ -1682,9 +1685,14 @@ 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);
+        // If the derived class is not in the ref ID table, then it
+        // is a hidden (protected, private, etc.) class, so don't include it.
+        if (_refIds.find(_classes[classname].derived[i]) != _refIds.end())
+        {
+            string derivedClassName = getIdentifier(_classes[classname].derived[i]);
+            derived.insert(derivedClassName);
+            getAllDerived(derived, derivedClassName);
+        }
     }
 }
 
@@ -1767,6 +1775,11 @@ static inline bool isNamespaceFile(const string& s)
     return false;
 }
 
+static inline bool isGeneratedBindingFile(const string& s)
+{
+    return ( (s.find(".cpp") == s.size() - 4) || (s.find(".h") == s.size() - 2) );
+}
+
 static bool getFileList(string directory, vector<string>& files, bool (*isWantedFile)(const string& s))
 {
 #ifdef WIN32

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

@@ -199,6 +199,7 @@ private:
     map<string, EnumBinding> _enums;
     map<string, vector<string> > _namespaces;
     map<string, TypedefBinding> _typedefs;
+    set<string> __warnings;
 };
 
 #endif

+ 0 - 4
gameplay/gameplay.vcxproj

@@ -102,7 +102,6 @@
     <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_FontJustify.cpp" />
     <ClCompile Include="src\lua\lua_FontStyle.cpp" />
     <ClCompile Include="src\lua\lua_FontText.cpp" />
@@ -186,7 +185,6 @@
     <ClCompile Include="src\lua\lua_RenderTarget.cpp" />
     <ClCompile Include="src\lua\lua_Scene.cpp" />
     <ClCompile Include="src\lua\lua_SceneDebugFlags.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" />
@@ -360,7 +358,6 @@
     <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_FontJustify.h" />
     <ClInclude Include="src\lua\lua_FontStyle.h" />
     <ClInclude Include="src\lua\lua_FontText.h" />
@@ -444,7 +441,6 @@
     <ClInclude Include="src\lua\lua_RenderTarget.h" />
     <ClInclude Include="src\lua\lua_Scene.h" />
     <ClInclude Include="src\lua\lua_SceneDebugFlags.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" />

+ 0 - 12
gameplay/gameplay.vcxproj.filters

@@ -366,9 +366,6 @@
     <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>
@@ -540,9 +537,6 @@
     <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>
@@ -1145,9 +1139,6 @@
     <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>
@@ -1319,9 +1310,6 @@
     <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>

+ 2 - 0
gameplay/src/AudioSource.h

@@ -40,6 +40,7 @@ public:
      * 
      * @param url The relative location on disk of the sound file or a URL specifying a Properties object defining an audio source.
      * @return The newly created audio source, or NULL if an audio source cannot be created.
+     * @script{create}
      */
     static AudioSource* create(const char* url);
 
@@ -48,6 +49,7 @@ public:
      * 
      * @param properties The properties object defining the audio source (must have namespace equal to 'audio').
      * @return The newly created audio source, or <code>NULL</code> if the audio source failed to load.
+     * @script{create}
      */
     static AudioSource* create(Properties* properties);
 

+ 5 - 0
gameplay/src/Bundle.h

@@ -29,6 +29,7 @@ public:
      * release() method must be called. Note that calling release() does
      * NOT free any actual game objects created/returned from the Bundle
      * instance and those objects must be released separately.
+     * @script{create}
      */
     static Bundle* create(const char* path);
 
@@ -39,6 +40,7 @@ public:
      * @param id The ID of the scene to load (NULL to load the first scene).
      * 
      * @return The loaded scene, or NULL if the scene could not be loaded.
+     * @script{create}
      */
     Scene* loadScene(const char* id = NULL);
 
@@ -48,6 +50,7 @@ public:
      * @param id The ID of the node to load in the bundle.
      * 
      * @return The loaded node, or NULL if the node could not be loaded.
+     * @script{create}
      */
     Node* loadNode(const char* id);
 
@@ -57,6 +60,7 @@ public:
      * @param id The ID of the mesh to load.
      * 
      * @return The loaded mesh, or NULL if the mesh could not be loaded.
+     * @script{create}
      */
     Mesh* loadMesh(const char* id);
 
@@ -66,6 +70,7 @@ public:
      * @param id The ID of the font to load.
      * 
      * @return The loaded font, or NULL if the font could not be loaded.
+     * @script{create}
      */
     Font* loadFont(const char* id);
 

+ 1 - 0
gameplay/src/CheckBox.h

@@ -44,6 +44,7 @@ public:
      * @param style The control's style.
      *
      * @return The new check box.
+     * @script{create}
      */
     static CheckBox* create(const char* id, Theme::Style* style);
 

+ 1 - 0
gameplay/src/Container.h

@@ -72,6 +72,7 @@ public:
      * @param layoutType The container's layout type.
      *
      * @return The new container.
+     * @script{create}
      */
     static Container* create(const char* id, Theme::Style* style, Layout::Type layoutType = Layout::LAYOUT_ABSOLUTE);
 

+ 1 - 0
gameplay/src/Curve.h

@@ -280,6 +280,7 @@ public:
      * 
      * @param pointCount The number of points in the curve.
      * @param componentCount The number of float component values per key value.
+     * @script{create}
      */
     static Curve* create(unsigned int pointCount, unsigned int componentCount);
 

+ 1 - 0
gameplay/src/DepthStencilTarget.h

@@ -45,6 +45,7 @@ public:
      * @param height Height of the new DepthStencilTarget.
      *
      * @return A newly created DepthStencilTarget.
+     * @script{create}
      */
     static DepthStencilTarget* create(const char* id, Format format, unsigned int width, unsigned int height);
 

+ 40 - 39
gameplay/src/Font.h

@@ -54,28 +54,6 @@ public:
         ALIGN_BOTTOM_RIGHT = ALIGN_BOTTOM | ALIGN_RIGHT
     };
 
-    /**
-     * Defines a font glyph within the texture map for a font.
-     */
-    class Glyph
-    {
-    public:
-        /**
-         * Glyph character code (decimal value).
-         */
-        unsigned int code;
-
-        /**
-         * Glyph width (in pixels).
-         */
-        unsigned int width;
-
-        /**
-         * Glyph texture coordinates.
-         */
-        float uvs[4];
-    };
-
     /**
      * Vertex coordinates, UVs and indices can be computed and stored in a Text object.
      * For static text labels that do not change frequently, this means these computations
@@ -129,26 +107,10 @@ public:
      * @param id An optional ID of the font resource within the bundle (NULL for the first/only resource).
      * 
      * @return The specified font.
+     * @script{create}
      */
     static Font* create(const char* path, const char* id = NULL);
 
-    /**
-     * Creates a font with the given characteristics from the specified glyph array and texture map.
-     *
-     * This method will create a new Font object regardless of whether another Font is already
-     * created with the same attributes.
-     *
-     * @param family The font family name.
-     * @param style The font style.
-     * @param size The font size.
-     * @param glyphs An array of font glyphs, defining each character in the font within the texture map.
-     * @param glyphCount The number of items in the glyph array.
-     * @param texture A texture map containing rendered glyphs.
-     * 
-     * @return The new Font.
-     */
-    static Font* create(const char* family, Style style, unsigned int size, Glyph* glyphs, int glyphCount, Texture* texture);
-
     /**
      * Returns the font size (max height of glyphs) in pixels.
      */
@@ -275,6 +237,27 @@ public:
 
 
 private:
+    /**
+     * Defines a font glyph within the texture map for a font.
+     */
+    class Glyph
+    {
+    public:
+        /**
+         * Glyph character code (decimal value).
+         */
+        unsigned int code;
+
+        /**
+         * Glyph width (in pixels).
+         */
+        unsigned int width;
+
+        /**
+         * Glyph texture coordinates.
+         */
+        float uvs[4];
+    };
 
     /**
      * Constructor.
@@ -296,6 +279,24 @@ private:
      */
     Font& operator=(const Font&);
 
+    /**
+     * Creates a font with the given characteristics from the specified glyph array and texture map.
+     *
+     * This method will create a new Font object regardless of whether another Font is already
+     * created with the same attributes.
+     *
+     * @param family The font family name.
+     * @param style The font style.
+     * @param size The font size.
+     * @param glyphs An array of font glyphs, defining each character in the font within the texture map.
+     * @param glyphCount The number of items in the glyph array.
+     * @param texture A texture map containing rendered glyphs.
+     * 
+     * @return The new Font.
+     * @script{create}
+     */
+    static Font* create(const char* family, Style style, unsigned int size, Glyph* glyphs, int glyphCount, Texture* texture);
+
     void getMeasurementInfo(const char* text, const Rectangle& area, unsigned int size, Justify justify, bool wrap, bool rightToLeft,
                             std::vector<int>* xPositions, int* yPosition, std::vector<unsigned int>* lineLengths);
 

+ 2 - 0
gameplay/src/Form.h

@@ -56,6 +56,7 @@ public:
      * (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional). 
      * 
      * @param url The URL pointing to the Properties object defining the form. 
+     * @script{create}
      */
     static Form* create(const char* url);
 
@@ -67,6 +68,7 @@ public:
      * @param layoutType The form's layout type.
      *
      * @return The new Form.
+     * @script{create}
      */
     static Form* create(const char* id, Theme::Style* style, Layout::Type layoutType = Layout::LAYOUT_ABSOLUTE);
 

+ 1 - 0
gameplay/src/FrameBuffer.h

@@ -33,6 +33,7 @@ public:
      * @param height The height of the RenderTarget to be created and attached.
      *
      * @return A newly created FrameBuffer.
+     * @script{create}
      */
     static FrameBuffer* create(const char* id, unsigned int width, unsigned int height);
 

+ 1 - 0
gameplay/src/Image.h

@@ -27,6 +27,7 @@ public:
      * 
      * @param path The path to the image file.
      * @return The newly created image.
+     * @script{create}
      */
     static Image* create(const char* path);
 

+ 1 - 0
gameplay/src/Joystick.h

@@ -23,6 +23,7 @@ public:
      * @param style The control's style.
      *
      * @return The new joystick.
+     * @script{create}
      */
     static Joystick* create(const char* id, Theme::Style* style);
     

+ 1 - 0
gameplay/src/Label.h

@@ -40,6 +40,7 @@ public:
      * @param style The control's style.
      *
      * @return The new label.
+     * @script{create}
      */
     static Label* create(const char*id, Theme::Style* style);
 

+ 4 - 0
gameplay/src/Material.h

@@ -35,6 +35,7 @@ public:
      * @param url The URL pointing to the Properties object defining the material.
      * 
      * @return A new Material.
+     * @script{create}
      */
     static Material* create(const char* url);
 
@@ -44,6 +45,7 @@ public:
      * @param materialProperties The properties object defining the 
      *      material (must have namespace equal to 'material').
      * @return A new Material.
+     * @script{create}
      */
     static Material* create(Properties* materialProperties);
 
@@ -56,6 +58,7 @@ public:
      * @param effect Effect for the new material.
      * 
      * @return A new Material.
+     * @script{create}
      */
     static Material* create(Effect* effect);
 
@@ -70,6 +73,7 @@ public:
      * @param defines New-line delimitted list of preprocessor defines.
      * 
      * @return A new Material.
+     * @script{create}
      */
     static Material* create(const char* vshPath, const char* fshPath, const char* defines = NULL);
 

+ 2 - 0
gameplay/src/MeshBatch.h

@@ -25,6 +25,7 @@ public:
      * @param growSize Amount to grow the batch by when it overflows (a value of zero prevents batch growing).
      *
      * @return A new mesh batch.
+     * @script{create}
      */
     static MeshBatch* create(const VertexFormat& vertexFormat, Mesh::PrimitiveType primitiveType, const char* materialPath, bool indexed, unsigned int initialCapacity = 1024, unsigned int growSize = 1024);
 
@@ -39,6 +40,7 @@ public:
      * @param growSize Amount to grow the batch by when it overflows (a value of zero prevents batch growing).
      *
      * @return A new mesh batch.
+     * @script{create}
      */
     static MeshBatch* create(const VertexFormat& vertexFormat, Mesh::PrimitiveType primitiveType, Material* material, bool indexed, unsigned int initialCapacity = 1024, unsigned int growSize = 1024);
 

+ 1 - 0
gameplay/src/Model.h

@@ -27,6 +27,7 @@ public:
 
     /**
      * Creates a new Model.
+     * @script{create}
      */
     static Model* create(Mesh* mesh);
 

+ 1 - 0
gameplay/src/Node.h

@@ -45,6 +45,7 @@ public:
      * Creates a new node with the specified ID.
      *
      * @param id The ID for the new node.
+     * @script{create}
      */
     static Node* create(const char* id = NULL);
 

+ 3 - 0
gameplay/src/ParticleEmitter.h

@@ -161,6 +161,7 @@ public:
      * @param url The URL pointing to the Properties object defining the particle emitter.
      * 
      * @return An initialized ParticleEmitter.
+     * @script{create}
      */
     static ParticleEmitter* create(const char* url);
 
@@ -170,6 +171,7 @@ public:
      * @param properties The properties object defining the 
      *      particle emitter (must have namespace equal to 'particle').
      * @return The newly created particle emitter, or <code>NULL</code> if the particle emitter failed to load.
+     * @script{create}
      */
     static ParticleEmitter* create(Properties* properties);
 
@@ -179,6 +181,7 @@ public:
      * @param texturePath A path to the image to use as this ParticleEmitter's texture.
      * @param textureBlending The type of texture blending to be used for the particles emitted.
      * @param particleCountMax The maximum number of particles that can be alive at one time in this ParticleEmitter's system.
+     * @script{create}
      */
     static ParticleEmitter* create(const char* texturePath, TextureBlending textureBlending,  unsigned int particleCountMax);
 

+ 1 - 0
gameplay/src/Properties.h

@@ -150,6 +150,7 @@ public:
      * (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional).
      * 
      * @param url The URL to create the properties from.
+     * @script{create}
      */
     static Properties* create(const char* url);
 

+ 1 - 0
gameplay/src/RadioButton.h

@@ -46,6 +46,7 @@ public:
      * @param style The control's style.
      *
      * @return The new radio button.
+     * @script{create}
      */
     static RadioButton* create(const char* id, Theme::Style* style);
 

+ 1 - 0
gameplay/src/RenderState.h

@@ -120,6 +120,7 @@ public:
 
         /**
          * Creates a new StateBlock with default render state settings.
+         * @script{create}
          */
         static StateBlock* create();
 

+ 1 - 0
gameplay/src/RenderTarget.h

@@ -25,6 +25,7 @@ public:
      * @param height The height of the new RenderTarget.
      *
      * @return A newly created RenderTarget.
+     * @script{create}
      */
     static RenderTarget* create(const char* id, unsigned int width, unsigned int height);
 

+ 1 - 0
gameplay/src/SceneLoader.h

@@ -12,6 +12,7 @@ namespace gameplay
 
 /**
  * Helper class for loading scenes from .scene files.
+ * @script{ignore}
  */
 class SceneLoader
 {

+ 7 - 0
gameplay/src/ScriptController.cpp

@@ -488,6 +488,10 @@ ScriptController::ScriptController() : _lua(NULL)
 
 ScriptController::~ScriptController()
 {
+    for (unsigned int i = 0; i < CALLBACK_COUNT; i++)
+    {
+        SAFE_DELETE(_callbacks[i]);
+    }
 }
 
 void ScriptController::initialize()
@@ -519,6 +523,9 @@ void ScriptController::finalizeGame()
     {
         executeFunction<void>(_callbacks[FINALIZE]->c_str());
     }
+
+    // Perform a full garbage collection cycle.
+    lua_gc(_lua, LUA_GCCOLLECT, 0);
 }
 
 void ScriptController::update(float elapsedTime)

+ 1 - 0
gameplay/src/Slider.h

@@ -42,6 +42,7 @@ public:
      * @param style The control's style.
      *
      * @return The new slider.
+     * @script{create}
      */
     static Slider* create(const char* id, Theme::Style* style);
 

+ 2 - 0
gameplay/src/SpriteBatch.h

@@ -52,6 +52,7 @@ public:
      * @param initialCapacity An optional initial capacity of the batch (number of sprites).
      * 
      * @return A new SpriteBatch for drawing sprites using the given texture.
+     * @script{create}
      */
     static SpriteBatch* create(const char* texturePath, Effect* effect = NULL, unsigned int initialCapacity = 0);
 
@@ -78,6 +79,7 @@ public:
      * @param initialCapacity An optional initial capacity of the batch (number of sprites).
      * 
      * @return A new SpriteBatch for drawing sprites using the given texture.
+     * @script{create}
      */
     static SpriteBatch* create(Texture* texture, Effect* effect = NULL, unsigned int initialCapacity = 0);
 

+ 1 - 0
gameplay/src/TextBox.h

@@ -46,6 +46,7 @@ public:
      * @param style The control's style.
      *
      * @return The new text box.
+     * @script{create}
      */
     static TextBox* create(const char* id, Theme::Style* style);
 

+ 5 - 0
gameplay/src/Texture.h

@@ -69,6 +69,7 @@ public:
          * @param texture The texture.
          *
          * @return The new sampler.
+         * @script{create}
          */
         static Sampler* create(Texture* texture);
 
@@ -79,6 +80,7 @@ public:
          * @param generateMipmaps True to force a full mipmap chain to be generated for the texture, false otherwise.
          *
          * @return The new sampler.
+         * @script{create}
          */
         static Sampler* create(const char* path, bool generateMipmaps = false);
 
@@ -138,16 +140,19 @@ public:
      * @param generateMipmaps true to auto-generate a full mipmap chain, false otherwise.
      * 
      * @return The new texture, or NULL if the texture could not be loaded/created.
+     * @script{create}
      */
     static Texture* create(const char* path, bool generateMipmaps = false);
 
     /**
      * Creates a texture from the given image.
+     * @script{create}
      */
     static Texture* create(Image* image, bool generateMipmaps = false);
 
     /**
      * Creates a texture from the given texture data.
+     * @script{create}
      */
     static Texture* create(Format format, unsigned int width, unsigned int height, unsigned char* data, bool generateMipmaps = false);
 

+ 1 - 0
gameplay/src/Theme.h

@@ -299,6 +299,7 @@ public:
      * (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional). 
      * 
      * @param url The URL pointing to the Properties object defining the theme. 
+     * @script{create}
      */
     static Theme* create(const char* url);
 

+ 1 - 0
gameplay/src/VertexAttributeBinding.h

@@ -46,6 +46,7 @@ public:
      * @param effect The effect.
      * 
      * @return A VertexAttributeBinding for the requested parameters.
+     * @script{create}
      */
     static VertexAttributeBinding* create(Mesh* mesh, Effect* effect);
 

+ 1 - 0
gameplay/src/VerticalLayout.h

@@ -20,6 +20,7 @@ public:
      * Create a VerticalLayout.
      *
      * @return a VerticalLayout object.
+     * @script{create}
      */
     static VerticalLayout* create();
 

+ 469 - 469
gameplay/src/lua/lua_AIAgent.cpp

@@ -1,469 +1,469 @@
-#include "Base.h"
-#include "ScriptController.h"
-#include "lua_AIAgent.h"
-#include "AIAgent.h"
-#include "Base.h"
-#include "Game.h"
-#include "Node.h"
-#include "Ref.h"
-
-namespace gameplay
-{
-
-void luaRegister_AIAgent()
-{
-    const luaL_Reg lua_members[] = 
-    {
-        {"addRef", lua_AIAgent_addRef},
-        {"getId", lua_AIAgent_getId},
-        {"getNode", lua_AIAgent_getNode},
-        {"getRefCount", lua_AIAgent_getRefCount},
-        {"getStateMachine", lua_AIAgent_getStateMachine},
-        {"isEnabled", lua_AIAgent_isEnabled},
-        {"release", lua_AIAgent_release},
-        {"setEnabled", lua_AIAgent_setEnabled},
-        {"setListener", lua_AIAgent_setListener},
-        {NULL, NULL}
-    };
-    const luaL_Reg lua_statics[] = 
-    {
-        {"create", lua_AIAgent_static_create},
-        {NULL, NULL}
-    };
-    std::vector<std::string> scopePath;
-
-    ScriptUtil::registerClass("AIAgent", lua_members, NULL, lua_AIAgent__gc, lua_statics, scopePath);
-}
-
-static AIAgent* getInstance(lua_State* state)
-{
-    void* userdata = luaL_checkudata(state, 1, "AIAgent");
-    luaL_argcheck(state, userdata != NULL, 1, "'AIAgent' expected.");
-    return (AIAgent*)((ScriptUtil::LuaObject*)userdata)->instance;
-}
-
-int lua_AIAgent__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, "AIAgent");
-                luaL_argcheck(state, userdata != NULL, 1, "'AIAgent' expected.");
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
-                if (object->owns)
-                {
-                    AIAgent* instance = (AIAgent*)object->instance;
-                    SAFE_RELEASE(instance);
-                }
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_AIAgent_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))
-            {
-                AIAgent* instance = getInstance(state);
-                instance->addRef();
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_addRef - 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_AIAgent_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))
-            {
-                AIAgent* 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, "lua_AIAgent_getId - 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_AIAgent_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))
-            {
-                AIAgent* instance = getInstance(state);
-                void* returnPtr = (void*)instance->getNode();
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Node");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_getNode - 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_AIAgent_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))
-            {
-                AIAgent* 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, "lua_AIAgent_getRefCount - 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_AIAgent_getStateMachine(lua_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))
-            {
-                AIAgent* instance = getInstance(state);
-                void* returnPtr = (void*)instance->getStateMachine();
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AIStateMachine");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_getStateMachine - 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_AIAgent_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))
-            {
-                AIAgent* instance = getInstance(state);
-                bool result = instance->isEnabled();
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_isEnabled - 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_AIAgent_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))
-            {
-                AIAgent* instance = getInstance(state);
-                instance->release();
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_release - 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_AIAgent_setEnabled(lua_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 = ScriptUtil::luaCheckBool(state, 2);
-
-                AIAgent* instance = getInstance(state);
-                instance->setEnabled(param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_setEnabled - 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_AIAgent_setListener(lua_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 || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                AIAgent::Listener* param1 = ScriptUtil::getObjectPointer<AIAgent::Listener>(2, "AIAgentListener", false);
-
-                AIAgent* instance = getInstance(state);
-                instance->setListener(param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_setListener - 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_AIAgent_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 0:
-        {
-            void* returnPtr = (void*)AIAgent::create();
-            if (returnPtr)
-            {
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                object->instance = returnPtr;
-                object->owns = false;
-                luaL_getmetatable(state, "AIAgent");
-                lua_setmetatable(state, -2);
-            }
-            else
-            {
-                lua_pushnil(state);
-            }
-
-            return 1;
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 0).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-}
+#include "Base.h"
+#include "ScriptController.h"
+#include "lua_AIAgent.h"
+#include "AIAgent.h"
+#include "Base.h"
+#include "Game.h"
+#include "Node.h"
+#include "Ref.h"
+
+namespace gameplay
+{
+
+void luaRegister_AIAgent()
+{
+    const luaL_Reg lua_members[] = 
+    {
+        {"addRef", lua_AIAgent_addRef},
+        {"getId", lua_AIAgent_getId},
+        {"getNode", lua_AIAgent_getNode},
+        {"getRefCount", lua_AIAgent_getRefCount},
+        {"getStateMachine", lua_AIAgent_getStateMachine},
+        {"isEnabled", lua_AIAgent_isEnabled},
+        {"release", lua_AIAgent_release},
+        {"setEnabled", lua_AIAgent_setEnabled},
+        {"setListener", lua_AIAgent_setListener},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"create", lua_AIAgent_static_create},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    ScriptUtil::registerClass("AIAgent", lua_members, NULL, lua_AIAgent__gc, lua_statics, scopePath);
+}
+
+static AIAgent* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AIAgent");
+    luaL_argcheck(state, userdata != NULL, 1, "'AIAgent' expected.");
+    return (AIAgent*)((ScriptUtil::LuaObject*)userdata)->instance;
+}
+
+int lua_AIAgent__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, "AIAgent");
+                luaL_argcheck(state, userdata != NULL, 1, "'AIAgent' expected.");
+                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    AIAgent* instance = (AIAgent*)object->instance;
+                    SAFE_RELEASE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgent__gc - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AIAgent_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))
+            {
+                AIAgent* instance = getInstance(state);
+                instance->addRef();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgent_addRef - 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_AIAgent_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))
+            {
+                AIAgent* 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, "lua_AIAgent_getId - 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_AIAgent_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))
+            {
+                AIAgent* instance = getInstance(state);
+                void* returnPtr = (void*)instance->getNode();
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "Node");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgent_getNode - 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_AIAgent_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))
+            {
+                AIAgent* 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, "lua_AIAgent_getRefCount - 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_AIAgent_getStateMachine(lua_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))
+            {
+                AIAgent* instance = getInstance(state);
+                void* returnPtr = (void*)instance->getStateMachine();
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "AIStateMachine");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgent_getStateMachine - 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_AIAgent_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))
+            {
+                AIAgent* instance = getInstance(state);
+                bool result = instance->isEnabled();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgent_isEnabled - 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_AIAgent_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))
+            {
+                AIAgent* instance = getInstance(state);
+                instance->release();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgent_release - 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_AIAgent_setEnabled(lua_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 = ScriptUtil::luaCheckBool(state, 2);
+
+                AIAgent* instance = getInstance(state);
+                instance->setEnabled(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgent_setEnabled - 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_AIAgent_setListener(lua_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 || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                AIAgent::Listener* param1 = ScriptUtil::getObjectPointer<AIAgent::Listener>(2, "AIAgentListener", false);
+
+                AIAgent* instance = getInstance(state);
+                instance->setListener(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgent_setListener - 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_AIAgent_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 0:
+        {
+            void* returnPtr = (void*)AIAgent::create();
+            if (returnPtr)
+            {
+                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                object->instance = returnPtr;
+                object->owns = false;
+                luaL_getmetatable(state, "AIAgent");
+                lua_setmetatable(state, -2);
+            }
+            else
+            {
+                lua_pushnil(state);
+            }
+
+            return 1;
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 0).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+}

+ 24 - 24
gameplay/src/lua/lua_AIAgent.h

@@ -1,24 +1,24 @@
-#ifndef LUA_AIAGENT_H_
-#define LUA_AIAGENT_H_
-
-namespace gameplay
-{
-
-// Lua bindings for AIAgent.
-int lua_AIAgent__gc(lua_State* state);
-int lua_AIAgent_addRef(lua_State* state);
-int lua_AIAgent_getId(lua_State* state);
-int lua_AIAgent_getNode(lua_State* state);
-int lua_AIAgent_getRefCount(lua_State* state);
-int lua_AIAgent_getStateMachine(lua_State* state);
-int lua_AIAgent_isEnabled(lua_State* state);
-int lua_AIAgent_release(lua_State* state);
-int lua_AIAgent_setEnabled(lua_State* state);
-int lua_AIAgent_setListener(lua_State* state);
-int lua_AIAgent_static_create(lua_State* state);
-
-void luaRegister_AIAgent();
-
-}
-
-#endif
+#ifndef LUA_AIAGENT_H_
+#define LUA_AIAGENT_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AIAgent.
+int lua_AIAgent__gc(lua_State* state);
+int lua_AIAgent_addRef(lua_State* state);
+int lua_AIAgent_getId(lua_State* state);
+int lua_AIAgent_getNode(lua_State* state);
+int lua_AIAgent_getRefCount(lua_State* state);
+int lua_AIAgent_getStateMachine(lua_State* state);
+int lua_AIAgent_isEnabled(lua_State* state);
+int lua_AIAgent_release(lua_State* state);
+int lua_AIAgent_setEnabled(lua_State* state);
+int lua_AIAgent_setListener(lua_State* state);
+int lua_AIAgent_static_create(lua_State* state);
+
+void luaRegister_AIAgent();
+
+}
+
+#endif

+ 115 - 115
gameplay/src/lua/lua_AIAgentListener.cpp

@@ -1,115 +1,115 @@
-#include "Base.h"
-#include "ScriptController.h"
-#include "lua_AIAgentListener.h"
-#include "AIAgent.h"
-#include "Base.h"
-#include "Game.h"
-#include "Node.h"
-#include "Ref.h"
-
-namespace gameplay
-{
-
-void luaRegister_AIAgentListener()
-{
-    const luaL_Reg lua_members[] = 
-    {
-        {"messageReceived", lua_AIAgentListener_messageReceived},
-        {NULL, NULL}
-    };
-    const luaL_Reg* lua_statics = NULL;
-    std::vector<std::string> scopePath;
-    scopePath.push_back("AIAgent");
-
-    ScriptUtil::registerClass("AIAgentListener", lua_members, NULL, lua_AIAgentListener__gc, lua_statics, scopePath);
-}
-
-static AIAgent::Listener* getInstance(lua_State* state)
-{
-    void* userdata = luaL_checkudata(state, 1, "AIAgentListener");
-    luaL_argcheck(state, userdata != NULL, 1, "'AIAgentListener' expected.");
-    return (AIAgent::Listener*)((ScriptUtil::LuaObject*)userdata)->instance;
-}
-
-int lua_AIAgentListener__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, "AIAgentListener");
-                luaL_argcheck(state, userdata != NULL, 1, "'AIAgentListener' expected.");
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
-                if (object->owns)
-                {
-                    AIAgent::Listener* instance = (AIAgent::Listener*)object->instance;
-                    SAFE_DELETE(instance);
-                }
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgentListener__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_AIAgentListener_messageReceived(lua_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 || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                AIMessage* param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false);
-
-                AIAgent::Listener* instance = getInstance(state);
-                bool result = instance->messageReceived(param1);
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgentListener_messageReceived - 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;
-}
-
-}
+#include "Base.h"
+#include "ScriptController.h"
+#include "lua_AIAgentListener.h"
+#include "AIAgent.h"
+#include "Base.h"
+#include "Game.h"
+#include "Node.h"
+#include "Ref.h"
+
+namespace gameplay
+{
+
+void luaRegister_AIAgentListener()
+{
+    const luaL_Reg lua_members[] = 
+    {
+        {"messageReceived", lua_AIAgentListener_messageReceived},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+    scopePath.push_back("AIAgent");
+
+    ScriptUtil::registerClass("AIAgentListener", lua_members, NULL, lua_AIAgentListener__gc, lua_statics, scopePath);
+}
+
+static AIAgent::Listener* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AIAgentListener");
+    luaL_argcheck(state, userdata != NULL, 1, "'AIAgentListener' expected.");
+    return (AIAgent::Listener*)((ScriptUtil::LuaObject*)userdata)->instance;
+}
+
+int lua_AIAgentListener__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, "AIAgentListener");
+                luaL_argcheck(state, userdata != NULL, 1, "'AIAgentListener' expected.");
+                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    AIAgent::Listener* instance = (AIAgent::Listener*)object->instance;
+                    SAFE_DELETE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgentListener__gc - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AIAgentListener_messageReceived(lua_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 || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                AIMessage* param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false);
+
+                AIAgent::Listener* instance = getInstance(state);
+                bool result = instance->messageReceived(param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIAgentListener_messageReceived - 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;
+}
+
+}

+ 15 - 15
gameplay/src/lua/lua_AIAgentListener.h

@@ -1,15 +1,15 @@
-#ifndef LUA_AIAGENTLISTENER_H_
-#define LUA_AIAGENTLISTENER_H_
-
-namespace gameplay
-{
-
-// Lua bindings for AIAgent::Listener.
-int lua_AIAgentListener__gc(lua_State* state);
-int lua_AIAgentListener_messageReceived(lua_State* state);
-
-void luaRegister_AIAgentListener();
-
-}
-
-#endif
+#ifndef LUA_AIAGENTLISTENER_H_
+#define LUA_AIAGENTLISTENER_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AIAgent::Listener.
+int lua_AIAgentListener__gc(lua_State* state);
+int lua_AIAgentListener_messageReceived(lua_State* state);
+
+void luaRegister_AIAgentListener();
+
+}
+
+#endif

+ 144 - 144
gameplay/src/lua/lua_AIController.cpp

@@ -1,144 +1,144 @@
-#include "Base.h"
-#include "ScriptController.h"
-#include "lua_AIController.h"
-#include "AIController.h"
-#include "Base.h"
-#include "Game.h"
-
-namespace gameplay
-{
-
-void luaRegister_AIController()
-{
-    const luaL_Reg lua_members[] = 
-    {
-        {"findAgent", lua_AIController_findAgent},
-        {"sendMessage", lua_AIController_sendMessage},
-        {NULL, NULL}
-    };
-    const luaL_Reg* lua_statics = NULL;
-    std::vector<std::string> scopePath;
-
-    ScriptUtil::registerClass("AIController", lua_members, NULL, NULL, lua_statics, scopePath);
-}
-
-static AIController* getInstance(lua_State* state)
-{
-    void* userdata = luaL_checkudata(state, 1, "AIController");
-    luaL_argcheck(state, userdata != NULL, 1, "'AIController' expected.");
-    return (AIController*)((ScriptUtil::LuaObject*)userdata)->instance;
-}
-
-int lua_AIController_findAgent(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = ScriptUtil::getString(2, false);
-
-                AIController* instance = getInstance(state);
-                void* returnPtr = (void*)instance->findAgent(param1);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AIAgent");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIController_findAgent - 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_AIController_sendMessage(lua_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 || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                AIMessage* param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false);
-
-                AIController* instance = getInstance(state);
-                instance->sendMessage(param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIController_sendMessage - 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, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                AIMessage* param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false);
-
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 3);
-
-                AIController* instance = getInstance(state);
-                instance->sendMessage(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIController_sendMessage - 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;
-}
-
-}
+#include "Base.h"
+#include "ScriptController.h"
+#include "lua_AIController.h"
+#include "AIController.h"
+#include "Base.h"
+#include "Game.h"
+
+namespace gameplay
+{
+
+void luaRegister_AIController()
+{
+    const luaL_Reg lua_members[] = 
+    {
+        {"findAgent", lua_AIController_findAgent},
+        {"sendMessage", lua_AIController_sendMessage},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+
+    ScriptUtil::registerClass("AIController", lua_members, NULL, NULL, lua_statics, scopePath);
+}
+
+static AIController* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AIController");
+    luaL_argcheck(state, userdata != NULL, 1, "'AIController' expected.");
+    return (AIController*)((ScriptUtil::LuaObject*)userdata)->instance;
+}
+
+int lua_AIController_findAgent(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = ScriptUtil::getString(2, false);
+
+                AIController* instance = getInstance(state);
+                void* returnPtr = (void*)instance->findAgent(param1);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "AIAgent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIController_findAgent - 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_AIController_sendMessage(lua_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 || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                AIMessage* param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false);
+
+                AIController* instance = getInstance(state);
+                instance->sendMessage(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIController_sendMessage - 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, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
+                lua_type(state, 3) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                AIMessage* param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false);
+
+                // Get parameter 2 off the stack.
+                float param2 = (float)luaL_checknumber(state, 3);
+
+                AIController* instance = getInstance(state);
+                instance->sendMessage(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIController_sendMessage - 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;
+}
+
+}

+ 15 - 15
gameplay/src/lua/lua_AIController.h

@@ -1,15 +1,15 @@
-#ifndef LUA_AICONTROLLER_H_
-#define LUA_AICONTROLLER_H_
-
-namespace gameplay
-{
-
-// Lua bindings for AIController.
-int lua_AIController_findAgent(lua_State* state);
-int lua_AIController_sendMessage(lua_State* state);
-
-void luaRegister_AIController();
-
-}
-
-#endif
+#ifndef LUA_AICONTROLLER_H_
+#define LUA_AICONTROLLER_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AIController.
+int lua_AIController_findAgent(lua_State* state);
+int lua_AIController_sendMessage(lua_State* state);
+
+void luaRegister_AIController();
+
+}
+
+#endif

+ 838 - 838
gameplay/src/lua/lua_AIMessage.cpp

@@ -1,838 +1,838 @@
-#include "Base.h"
-#include "ScriptController.h"
-#include "lua_AIMessage.h"
-#include "AIMessage.h"
-#include "Base.h"
-#include "lua_AIMessageParameterType.h"
-
-namespace gameplay
-{
-
-void luaRegister_AIMessage()
-{
-    const luaL_Reg lua_members[] = 
-    {
-        {"getBoolean", lua_AIMessage_getBoolean},
-        {"getDouble", lua_AIMessage_getDouble},
-        {"getFloat", lua_AIMessage_getFloat},
-        {"getId", lua_AIMessage_getId},
-        {"getInt", lua_AIMessage_getInt},
-        {"getLong", lua_AIMessage_getLong},
-        {"getParameterCount", lua_AIMessage_getParameterCount},
-        {"getParameterType", lua_AIMessage_getParameterType},
-        {"getReceiver", lua_AIMessage_getReceiver},
-        {"getSender", lua_AIMessage_getSender},
-        {"getString", lua_AIMessage_getString},
-        {"setBoolean", lua_AIMessage_setBoolean},
-        {"setDouble", lua_AIMessage_setDouble},
-        {"setFloat", lua_AIMessage_setFloat},
-        {"setInt", lua_AIMessage_setInt},
-        {"setLong", lua_AIMessage_setLong},
-        {"setString", lua_AIMessage_setString},
-        {NULL, NULL}
-    };
-    const luaL_Reg lua_statics[] = 
-    {
-        {"create", lua_AIMessage_static_create},
-        {NULL, NULL}
-    };
-    std::vector<std::string> scopePath;
-
-    ScriptUtil::registerClass("AIMessage", lua_members, NULL, lua_AIMessage__gc, lua_statics, scopePath);
-}
-
-static AIMessage* getInstance(lua_State* state)
-{
-    void* userdata = luaL_checkudata(state, 1, "AIMessage");
-    luaL_argcheck(state, userdata != NULL, 1, "'AIMessage' expected.");
-    return (AIMessage*)((ScriptUtil::LuaObject*)userdata)->instance;
-}
-
-int lua_AIMessage__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, "AIMessage");
-                luaL_argcheck(state, userdata != NULL, 1, "'AIMessage' expected.");
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
-                if (object->owns)
-                {
-                    AIMessage* instance = (AIMessage*)object->instance;
-                    SAFE_DELETE(instance);
-                }
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_AIMessage_getBoolean(lua_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);
-
-                AIMessage* instance = getInstance(state);
-                bool result = instance->getBoolean(param1);
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getBoolean - 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_AIMessage_getDouble(lua_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);
-
-                AIMessage* instance = getInstance(state);
-                double result = instance->getDouble(param1);
-
-                // Push the return value onto the stack.
-                lua_pushnumber(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getDouble - 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_AIMessage_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);
-
-                AIMessage* 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, "lua_AIMessage_getFloat - 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_AIMessage_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))
-            {
-                AIMessage* instance = getInstance(state);
-                unsigned int result = instance->getId();
-
-                // Push the return value onto the stack.
-                lua_pushunsigned(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getId - 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_AIMessage_getInt(lua_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);
-
-                AIMessage* instance = getInstance(state);
-                int result = instance->getInt(param1);
-
-                // Push the return value onto the stack.
-                lua_pushinteger(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getInt - 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_AIMessage_getLong(lua_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);
-
-                AIMessage* instance = getInstance(state);
-                long result = instance->getLong(param1);
-
-                // Push the return value onto the stack.
-                lua_pushinteger(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getLong - 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_AIMessage_getParameterCount(lua_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))
-            {
-                AIMessage* instance = getInstance(state);
-                unsigned int result = instance->getParameterCount();
-
-                // Push the return value onto the stack.
-                lua_pushunsigned(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getParameterCount - 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_AIMessage_getParameterType(lua_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);
-
-                AIMessage* instance = getInstance(state);
-                AIMessage::ParameterType result = instance->getParameterType(param1);
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, lua_stringFromEnum_AIMessageParameterType(result));
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getParameterType - 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_AIMessage_getReceiver(lua_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))
-            {
-                AIMessage* instance = getInstance(state);
-                const char* result = instance->getReceiver();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getReceiver - 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_AIMessage_getSender(lua_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))
-            {
-                AIMessage* instance = getInstance(state);
-                const char* result = instance->getSender();
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getSender - 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_AIMessage_getString(lua_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);
-
-                AIMessage* instance = getInstance(state);
-                const char* result = instance->getString(param1);
-
-                // Push the return value onto the stack.
-                lua_pushstring(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getString - 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_AIMessage_setBoolean(lua_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_TBOOLEAN)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
-
-                // Get parameter 2 off the stack.
-                bool param2 = ScriptUtil::luaCheckBool(state, 3);
-
-                AIMessage* instance = getInstance(state);
-                instance->setBoolean(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setBoolean - 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_AIMessage_setDouble(lua_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.
-                double param2 = (double)luaL_checknumber(state, 3);
-
-                AIMessage* instance = getInstance(state);
-                instance->setDouble(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setDouble - 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_AIMessage_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);
-
-                AIMessage* instance = getInstance(state);
-                instance->setFloat(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setFloat - 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_AIMessage_setInt(lua_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.
-                int param2 = (int)luaL_checkint(state, 3);
-
-                AIMessage* instance = getInstance(state);
-                instance->setInt(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setInt - 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_AIMessage_setLong(lua_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.
-                long param2 = (long)luaL_checklong(state, 3);
-
-                AIMessage* instance = getInstance(state);
-                instance->setLong(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setLong - 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_AIMessage_setString(lua_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_TSTRING || lua_type(state, 3) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
-
-                // Get parameter 2 off the stack.
-                const char* param2 = ScriptUtil::getString(3, false);
-
-                AIMessage* instance = getInstance(state);
-                instance->setString(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setString - 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_AIMessage_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 4:
-        {
-            if (lua_type(state, 1) == LUA_TNUMBER &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL) &&
-                lua_type(state, 4) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
-
-                // Get parameter 2 off the stack.
-                const char* param2 = ScriptUtil::getString(2, false);
-
-                // Get parameter 3 off the stack.
-                const char* param3 = ScriptUtil::getString(3, false);
-
-                // Get parameter 4 off the stack.
-                unsigned int param4 = (unsigned int)luaL_checkunsigned(state, 4);
-
-                void* returnPtr = (void*)AIMessage::create(param1, param2, param3, param4);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AIMessage");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_static_create - 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;
-}
-
-}
+#include "Base.h"
+#include "ScriptController.h"
+#include "lua_AIMessage.h"
+#include "AIMessage.h"
+#include "Base.h"
+#include "lua_AIMessageParameterType.h"
+
+namespace gameplay
+{
+
+void luaRegister_AIMessage()
+{
+    const luaL_Reg lua_members[] = 
+    {
+        {"getBoolean", lua_AIMessage_getBoolean},
+        {"getDouble", lua_AIMessage_getDouble},
+        {"getFloat", lua_AIMessage_getFloat},
+        {"getId", lua_AIMessage_getId},
+        {"getInt", lua_AIMessage_getInt},
+        {"getLong", lua_AIMessage_getLong},
+        {"getParameterCount", lua_AIMessage_getParameterCount},
+        {"getParameterType", lua_AIMessage_getParameterType},
+        {"getReceiver", lua_AIMessage_getReceiver},
+        {"getSender", lua_AIMessage_getSender},
+        {"getString", lua_AIMessage_getString},
+        {"setBoolean", lua_AIMessage_setBoolean},
+        {"setDouble", lua_AIMessage_setDouble},
+        {"setFloat", lua_AIMessage_setFloat},
+        {"setInt", lua_AIMessage_setInt},
+        {"setLong", lua_AIMessage_setLong},
+        {"setString", lua_AIMessage_setString},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"create", lua_AIMessage_static_create},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    ScriptUtil::registerClass("AIMessage", lua_members, NULL, lua_AIMessage__gc, lua_statics, scopePath);
+}
+
+static AIMessage* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AIMessage");
+    luaL_argcheck(state, userdata != NULL, 1, "'AIMessage' expected.");
+    return (AIMessage*)((ScriptUtil::LuaObject*)userdata)->instance;
+}
+
+int lua_AIMessage__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, "AIMessage");
+                luaL_argcheck(state, userdata != NULL, 1, "'AIMessage' expected.");
+                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    AIMessage* instance = (AIMessage*)object->instance;
+                    SAFE_DELETE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage__gc - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AIMessage_getBoolean(lua_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);
+
+                AIMessage* instance = getInstance(state);
+                bool result = instance->getBoolean(param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_getBoolean - 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_AIMessage_getDouble(lua_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);
+
+                AIMessage* instance = getInstance(state);
+                double result = instance->getDouble(param1);
+
+                // Push the return value onto the stack.
+                lua_pushnumber(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_getDouble - 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_AIMessage_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);
+
+                AIMessage* 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, "lua_AIMessage_getFloat - 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_AIMessage_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))
+            {
+                AIMessage* instance = getInstance(state);
+                unsigned int result = instance->getId();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_getId - 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_AIMessage_getInt(lua_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);
+
+                AIMessage* instance = getInstance(state);
+                int result = instance->getInt(param1);
+
+                // Push the return value onto the stack.
+                lua_pushinteger(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_getInt - 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_AIMessage_getLong(lua_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);
+
+                AIMessage* instance = getInstance(state);
+                long result = instance->getLong(param1);
+
+                // Push the return value onto the stack.
+                lua_pushinteger(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_getLong - 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_AIMessage_getParameterCount(lua_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))
+            {
+                AIMessage* instance = getInstance(state);
+                unsigned int result = instance->getParameterCount();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_getParameterCount - 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_AIMessage_getParameterType(lua_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);
+
+                AIMessage* instance = getInstance(state);
+                AIMessage::ParameterType result = instance->getParameterType(param1);
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, lua_stringFromEnum_AIMessageParameterType(result));
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_getParameterType - 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_AIMessage_getReceiver(lua_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))
+            {
+                AIMessage* instance = getInstance(state);
+                const char* result = instance->getReceiver();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_getReceiver - 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_AIMessage_getSender(lua_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))
+            {
+                AIMessage* instance = getInstance(state);
+                const char* result = instance->getSender();
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_getSender - 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_AIMessage_getString(lua_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);
+
+                AIMessage* instance = getInstance(state);
+                const char* result = instance->getString(param1);
+
+                // Push the return value onto the stack.
+                lua_pushstring(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_getString - 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_AIMessage_setBoolean(lua_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_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                // Get parameter 2 off the stack.
+                bool param2 = ScriptUtil::luaCheckBool(state, 3);
+
+                AIMessage* instance = getInstance(state);
+                instance->setBoolean(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_setBoolean - 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_AIMessage_setDouble(lua_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.
+                double param2 = (double)luaL_checknumber(state, 3);
+
+                AIMessage* instance = getInstance(state);
+                instance->setDouble(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_setDouble - 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_AIMessage_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);
+
+                AIMessage* instance = getInstance(state);
+                instance->setFloat(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_setFloat - 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_AIMessage_setInt(lua_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.
+                int param2 = (int)luaL_checkint(state, 3);
+
+                AIMessage* instance = getInstance(state);
+                instance->setInt(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_setInt - 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_AIMessage_setLong(lua_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.
+                long param2 = (long)luaL_checklong(state, 3);
+
+                AIMessage* instance = getInstance(state);
+                instance->setLong(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_setLong - 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_AIMessage_setString(lua_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_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                // Get parameter 2 off the stack.
+                const char* param2 = ScriptUtil::getString(3, false);
+
+                AIMessage* instance = getInstance(state);
+                instance->setString(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_setString - 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_AIMessage_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 4:
+        {
+            if (lua_type(state, 1) == LUA_TNUMBER &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL) &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 1);
+
+                // Get parameter 2 off the stack.
+                const char* param2 = ScriptUtil::getString(2, false);
+
+                // Get parameter 3 off the stack.
+                const char* param3 = ScriptUtil::getString(3, false);
+
+                // Get parameter 4 off the stack.
+                unsigned int param4 = (unsigned int)luaL_checkunsigned(state, 4);
+
+                void* returnPtr = (void*)AIMessage::create(param1, param2, param3, param4);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "AIMessage");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIMessage_static_create - 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;
+}
+
+}

+ 32 - 32
gameplay/src/lua/lua_AIMessage.h

@@ -1,32 +1,32 @@
-#ifndef LUA_AIMESSAGE_H_
-#define LUA_AIMESSAGE_H_
-
-namespace gameplay
-{
-
-// Lua bindings for AIMessage.
-int lua_AIMessage__gc(lua_State* state);
-int lua_AIMessage_getBoolean(lua_State* state);
-int lua_AIMessage_getDouble(lua_State* state);
-int lua_AIMessage_getFloat(lua_State* state);
-int lua_AIMessage_getId(lua_State* state);
-int lua_AIMessage_getInt(lua_State* state);
-int lua_AIMessage_getLong(lua_State* state);
-int lua_AIMessage_getParameterCount(lua_State* state);
-int lua_AIMessage_getParameterType(lua_State* state);
-int lua_AIMessage_getReceiver(lua_State* state);
-int lua_AIMessage_getSender(lua_State* state);
-int lua_AIMessage_getString(lua_State* state);
-int lua_AIMessage_setBoolean(lua_State* state);
-int lua_AIMessage_setDouble(lua_State* state);
-int lua_AIMessage_setFloat(lua_State* state);
-int lua_AIMessage_setInt(lua_State* state);
-int lua_AIMessage_setLong(lua_State* state);
-int lua_AIMessage_setString(lua_State* state);
-int lua_AIMessage_static_create(lua_State* state);
-
-void luaRegister_AIMessage();
-
-}
-
-#endif
+#ifndef LUA_AIMESSAGE_H_
+#define LUA_AIMESSAGE_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AIMessage.
+int lua_AIMessage__gc(lua_State* state);
+int lua_AIMessage_getBoolean(lua_State* state);
+int lua_AIMessage_getDouble(lua_State* state);
+int lua_AIMessage_getFloat(lua_State* state);
+int lua_AIMessage_getId(lua_State* state);
+int lua_AIMessage_getInt(lua_State* state);
+int lua_AIMessage_getLong(lua_State* state);
+int lua_AIMessage_getParameterCount(lua_State* state);
+int lua_AIMessage_getParameterType(lua_State* state);
+int lua_AIMessage_getReceiver(lua_State* state);
+int lua_AIMessage_getSender(lua_State* state);
+int lua_AIMessage_getString(lua_State* state);
+int lua_AIMessage_setBoolean(lua_State* state);
+int lua_AIMessage_setDouble(lua_State* state);
+int lua_AIMessage_setFloat(lua_State* state);
+int lua_AIMessage_setInt(lua_State* state);
+int lua_AIMessage_setLong(lua_State* state);
+int lua_AIMessage_setString(lua_State* state);
+int lua_AIMessage_static_create(lua_State* state);
+
+void luaRegister_AIMessage();
+
+}
+
+#endif

+ 58 - 58
gameplay/src/lua/lua_AIMessageParameterType.cpp

@@ -1,58 +1,58 @@
-#include "Base.h"
-#include "lua_AIMessageParameterType.h"
-
-namespace gameplay
-{
-
-static const char* enumStringEmpty = "";
-
-static const char* luaEnumString_AIMessageParameterType_UNDEFINED = "UNDEFINED";
-static const char* luaEnumString_AIMessageParameterType_INTEGER = "INTEGER";
-static const char* luaEnumString_AIMessageParameterType_LONG = "LONG";
-static const char* luaEnumString_AIMessageParameterType_FLOAT = "FLOAT";
-static const char* luaEnumString_AIMessageParameterType_DOUBLE = "DOUBLE";
-static const char* luaEnumString_AIMessageParameterType_BOOLEAN = "BOOLEAN";
-static const char* luaEnumString_AIMessageParameterType_STRING = "STRING";
-
-AIMessage::ParameterType lua_enumFromString_AIMessageParameterType(const char* s)
-{
-    if (strcmp(s, luaEnumString_AIMessageParameterType_UNDEFINED) == 0)
-        return AIMessage::UNDEFINED;
-    if (strcmp(s, luaEnumString_AIMessageParameterType_INTEGER) == 0)
-        return AIMessage::INTEGER;
-    if (strcmp(s, luaEnumString_AIMessageParameterType_LONG) == 0)
-        return AIMessage::LONG;
-    if (strcmp(s, luaEnumString_AIMessageParameterType_FLOAT) == 0)
-        return AIMessage::FLOAT;
-    if (strcmp(s, luaEnumString_AIMessageParameterType_DOUBLE) == 0)
-        return AIMessage::DOUBLE;
-    if (strcmp(s, luaEnumString_AIMessageParameterType_BOOLEAN) == 0)
-        return AIMessage::BOOLEAN;
-    if (strcmp(s, luaEnumString_AIMessageParameterType_STRING) == 0)
-        return AIMessage::STRING;
-    GP_ERROR("Invalid enumeration value '%s' for enumeration AIMessage::ParameterType.", s);
-    return AIMessage::UNDEFINED;
-}
-
-const char* lua_stringFromEnum_AIMessageParameterType(AIMessage::ParameterType e)
-{
-    if (e == AIMessage::UNDEFINED)
-        return luaEnumString_AIMessageParameterType_UNDEFINED;
-    if (e == AIMessage::INTEGER)
-        return luaEnumString_AIMessageParameterType_INTEGER;
-    if (e == AIMessage::LONG)
-        return luaEnumString_AIMessageParameterType_LONG;
-    if (e == AIMessage::FLOAT)
-        return luaEnumString_AIMessageParameterType_FLOAT;
-    if (e == AIMessage::DOUBLE)
-        return luaEnumString_AIMessageParameterType_DOUBLE;
-    if (e == AIMessage::BOOLEAN)
-        return luaEnumString_AIMessageParameterType_BOOLEAN;
-    if (e == AIMessage::STRING)
-        return luaEnumString_AIMessageParameterType_STRING;
-    GP_ERROR("Invalid enumeration value '%d' for enumeration AIMessage::ParameterType.", e);
-    return enumStringEmpty;
-}
-
-}
-
+#include "Base.h"
+#include "lua_AIMessageParameterType.h"
+
+namespace gameplay
+{
+
+static const char* enumStringEmpty = "";
+
+static const char* luaEnumString_AIMessageParameterType_UNDEFINED = "UNDEFINED";
+static const char* luaEnumString_AIMessageParameterType_INTEGER = "INTEGER";
+static const char* luaEnumString_AIMessageParameterType_LONG = "LONG";
+static const char* luaEnumString_AIMessageParameterType_FLOAT = "FLOAT";
+static const char* luaEnumString_AIMessageParameterType_DOUBLE = "DOUBLE";
+static const char* luaEnumString_AIMessageParameterType_BOOLEAN = "BOOLEAN";
+static const char* luaEnumString_AIMessageParameterType_STRING = "STRING";
+
+AIMessage::ParameterType lua_enumFromString_AIMessageParameterType(const char* s)
+{
+    if (strcmp(s, luaEnumString_AIMessageParameterType_UNDEFINED) == 0)
+        return AIMessage::UNDEFINED;
+    if (strcmp(s, luaEnumString_AIMessageParameterType_INTEGER) == 0)
+        return AIMessage::INTEGER;
+    if (strcmp(s, luaEnumString_AIMessageParameterType_LONG) == 0)
+        return AIMessage::LONG;
+    if (strcmp(s, luaEnumString_AIMessageParameterType_FLOAT) == 0)
+        return AIMessage::FLOAT;
+    if (strcmp(s, luaEnumString_AIMessageParameterType_DOUBLE) == 0)
+        return AIMessage::DOUBLE;
+    if (strcmp(s, luaEnumString_AIMessageParameterType_BOOLEAN) == 0)
+        return AIMessage::BOOLEAN;
+    if (strcmp(s, luaEnumString_AIMessageParameterType_STRING) == 0)
+        return AIMessage::STRING;
+    GP_ERROR("Invalid enumeration value '%s' for enumeration AIMessage::ParameterType.", s);
+    return AIMessage::UNDEFINED;
+}
+
+const char* lua_stringFromEnum_AIMessageParameterType(AIMessage::ParameterType e)
+{
+    if (e == AIMessage::UNDEFINED)
+        return luaEnumString_AIMessageParameterType_UNDEFINED;
+    if (e == AIMessage::INTEGER)
+        return luaEnumString_AIMessageParameterType_INTEGER;
+    if (e == AIMessage::LONG)
+        return luaEnumString_AIMessageParameterType_LONG;
+    if (e == AIMessage::FLOAT)
+        return luaEnumString_AIMessageParameterType_FLOAT;
+    if (e == AIMessage::DOUBLE)
+        return luaEnumString_AIMessageParameterType_DOUBLE;
+    if (e == AIMessage::BOOLEAN)
+        return luaEnumString_AIMessageParameterType_BOOLEAN;
+    if (e == AIMessage::STRING)
+        return luaEnumString_AIMessageParameterType_STRING;
+    GP_ERROR("Invalid enumeration value '%d' for enumeration AIMessage::ParameterType.", e);
+    return enumStringEmpty;
+}
+
+}
+

+ 15 - 15
gameplay/src/lua/lua_AIMessageParameterType.h

@@ -1,15 +1,15 @@
-#ifndef LUA_AIMESSAGEPARAMETERTYPE_H_
-#define LUA_AIMESSAGEPARAMETERTYPE_H_
-
-#include "AIMessage.h"
-
-namespace gameplay
-{
-
-// Lua bindings for enum conversion functions for AIMessage::ParameterType.
-AIMessage::ParameterType lua_enumFromString_AIMessageParameterType(const char* s);
-const char* lua_stringFromEnum_AIMessageParameterType(AIMessage::ParameterType e);
-
-}
-
-#endif
+#ifndef LUA_AIMESSAGEPARAMETERTYPE_H_
+#define LUA_AIMESSAGEPARAMETERTYPE_H_
+
+#include "AIMessage.h"
+
+namespace gameplay
+{
+
+// Lua bindings for enum conversion functions for AIMessage::ParameterType.
+AIMessage::ParameterType lua_enumFromString_AIMessageParameterType(const char* s);
+const char* lua_stringFromEnum_AIMessageParameterType(AIMessage::ParameterType e);
+
+}
+
+#endif

+ 309 - 309
gameplay/src/lua/lua_AIState.cpp

@@ -1,309 +1,309 @@
-#include "Base.h"
-#include "ScriptController.h"
-#include "lua_AIState.h"
-#include "AIState.h"
-#include "AIStateMachine.h"
-#include "Base.h"
-#include "Game.h"
-#include "Ref.h"
-
-namespace gameplay
-{
-
-void luaRegister_AIState()
-{
-    const luaL_Reg lua_members[] = 
-    {
-        {"addRef", lua_AIState_addRef},
-        {"getId", lua_AIState_getId},
-        {"getRefCount", lua_AIState_getRefCount},
-        {"release", lua_AIState_release},
-        {"setListener", lua_AIState_setListener},
-        {NULL, NULL}
-    };
-    const luaL_Reg lua_statics[] = 
-    {
-        {"create", lua_AIState_static_create},
-        {NULL, NULL}
-    };
-    std::vector<std::string> scopePath;
-
-    ScriptUtil::registerClass("AIState", lua_members, NULL, lua_AIState__gc, lua_statics, scopePath);
-}
-
-static AIState* getInstance(lua_State* state)
-{
-    void* userdata = luaL_checkudata(state, 1, "AIState");
-    luaL_argcheck(state, userdata != NULL, 1, "'AIState' expected.");
-    return (AIState*)((ScriptUtil::LuaObject*)userdata)->instance;
-}
-
-int lua_AIState__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, "AIState");
-                luaL_argcheck(state, userdata != NULL, 1, "'AIState' expected.");
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
-                if (object->owns)
-                {
-                    AIState* instance = (AIState*)object->instance;
-                    SAFE_RELEASE(instance);
-                }
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIState__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_AIState_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))
-            {
-                AIState* instance = getInstance(state);
-                instance->addRef();
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIState_addRef - 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_AIState_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))
-            {
-                AIState* 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, "lua_AIState_getId - 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_AIState_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))
-            {
-                AIState* 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, "lua_AIState_getRefCount - 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_AIState_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))
-            {
-                AIState* instance = getInstance(state);
-                instance->release();
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIState_release - 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_AIState_setListener(lua_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 || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                AIState::Listener* param1 = ScriptUtil::getObjectPointer<AIState::Listener>(2, "AIStateListener", false);
-
-                AIState* instance = getInstance(state);
-                instance->setListener(param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIState_setListener - 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_AIState_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 || lua_type(state, 1) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = ScriptUtil::getString(1, false);
-
-                void* returnPtr = (void*)AIState::create(param1);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AIState");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIState_static_create - 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;
-}
-
-}
+#include "Base.h"
+#include "ScriptController.h"
+#include "lua_AIState.h"
+#include "AIState.h"
+#include "AIStateMachine.h"
+#include "Base.h"
+#include "Game.h"
+#include "Ref.h"
+
+namespace gameplay
+{
+
+void luaRegister_AIState()
+{
+    const luaL_Reg lua_members[] = 
+    {
+        {"addRef", lua_AIState_addRef},
+        {"getId", lua_AIState_getId},
+        {"getRefCount", lua_AIState_getRefCount},
+        {"release", lua_AIState_release},
+        {"setListener", lua_AIState_setListener},
+        {NULL, NULL}
+    };
+    const luaL_Reg lua_statics[] = 
+    {
+        {"create", lua_AIState_static_create},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    ScriptUtil::registerClass("AIState", lua_members, NULL, lua_AIState__gc, lua_statics, scopePath);
+}
+
+static AIState* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AIState");
+    luaL_argcheck(state, userdata != NULL, 1, "'AIState' expected.");
+    return (AIState*)((ScriptUtil::LuaObject*)userdata)->instance;
+}
+
+int lua_AIState__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, "AIState");
+                luaL_argcheck(state, userdata != NULL, 1, "'AIState' expected.");
+                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    AIState* instance = (AIState*)object->instance;
+                    SAFE_RELEASE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIState__gc - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AIState_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))
+            {
+                AIState* instance = getInstance(state);
+                instance->addRef();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIState_addRef - 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_AIState_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))
+            {
+                AIState* 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, "lua_AIState_getId - 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_AIState_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))
+            {
+                AIState* 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, "lua_AIState_getRefCount - 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_AIState_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))
+            {
+                AIState* instance = getInstance(state);
+                instance->release();
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIState_release - 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_AIState_setListener(lua_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 || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                AIState::Listener* param1 = ScriptUtil::getObjectPointer<AIState::Listener>(2, "AIStateListener", false);
+
+                AIState* instance = getInstance(state);
+                instance->setListener(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIState_setListener - 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_AIState_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 || lua_type(state, 1) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = ScriptUtil::getString(1, false);
+
+                void* returnPtr = (void*)AIState::create(param1);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "AIState");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIState_static_create - 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;
+}
+
+}

+ 20 - 20
gameplay/src/lua/lua_AIState.h

@@ -1,20 +1,20 @@
-#ifndef LUA_AISTATE_H_
-#define LUA_AISTATE_H_
-
-namespace gameplay
-{
-
-// Lua bindings for AIState.
-int lua_AIState__gc(lua_State* state);
-int lua_AIState_addRef(lua_State* state);
-int lua_AIState_getId(lua_State* state);
-int lua_AIState_getRefCount(lua_State* state);
-int lua_AIState_release(lua_State* state);
-int lua_AIState_setListener(lua_State* state);
-int lua_AIState_static_create(lua_State* state);
-
-void luaRegister_AIState();
-
-}
-
-#endif
+#ifndef LUA_AISTATE_H_
+#define LUA_AISTATE_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AIState.
+int lua_AIState__gc(lua_State* state);
+int lua_AIState_addRef(lua_State* state);
+int lua_AIState_getId(lua_State* state);
+int lua_AIState_getRefCount(lua_State* state);
+int lua_AIState_release(lua_State* state);
+int lua_AIState_setListener(lua_State* state);
+int lua_AIState_static_create(lua_State* state);
+
+void luaRegister_AIState();
+
+}
+
+#endif

+ 243 - 243
gameplay/src/lua/lua_AIStateListener.cpp

@@ -1,243 +1,243 @@
-#include "Base.h"
-#include "ScriptController.h"
-#include "lua_AIStateListener.h"
-#include "AIState.h"
-#include "AIStateMachine.h"
-#include "Base.h"
-#include "Game.h"
-#include "Ref.h"
-
-namespace gameplay
-{
-
-void luaRegister_AIStateListener()
-{
-    const luaL_Reg lua_members[] = 
-    {
-        {"stateEnter", lua_AIStateListener_stateEnter},
-        {"stateExit", lua_AIStateListener_stateExit},
-        {"stateUpdate", lua_AIStateListener_stateUpdate},
-        {NULL, NULL}
-    };
-    const luaL_Reg* lua_statics = NULL;
-    std::vector<std::string> scopePath;
-    scopePath.push_back("AIState");
-
-    ScriptUtil::registerClass("AIStateListener", lua_members, lua_AIStateListener__init, lua_AIStateListener__gc, lua_statics, scopePath);
-}
-
-static AIState::Listener* getInstance(lua_State* state)
-{
-    void* userdata = luaL_checkudata(state, 1, "AIStateListener");
-    luaL_argcheck(state, userdata != NULL, 1, "'AIStateListener' expected.");
-    return (AIState::Listener*)((ScriptUtil::LuaObject*)userdata)->instance;
-}
-
-int lua_AIStateListener__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, "AIStateListener");
-                luaL_argcheck(state, userdata != NULL, 1, "'AIStateListener' expected.");
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
-                if (object->owns)
-                {
-                    AIState::Listener* instance = (AIState::Listener*)object->instance;
-                    SAFE_DELETE(instance);
-                }
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateListener__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_AIStateListener__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:
-        {
-            void* returnPtr = (void*)new AIState::Listener();
-            if (returnPtr)
-            {
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                object->instance = returnPtr;
-                object->owns = true;
-                luaL_getmetatable(state, "AIStateListener");
-                lua_setmetatable(state, -2);
-            }
-            else
-            {
-                lua_pushnil(state);
-            }
-
-            return 1;
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 0).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_AIStateListener_stateEnter(lua_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, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
-                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                AIAgent* param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false);
-
-                // Get parameter 2 off the stack.
-                AIState* param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false);
-
-                AIState::Listener* instance = getInstance(state);
-                instance->stateEnter(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateListener_stateEnter - 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_AIStateListener_stateExit(lua_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, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
-                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                AIAgent* param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false);
-
-                // Get parameter 2 off the stack.
-                AIState* param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false);
-
-                AIState::Listener* instance = getInstance(state);
-                instance->stateExit(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateListener_stateExit - 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_AIStateListener_stateUpdate(lua_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_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
-                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) &&
-                lua_type(state, 4) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                AIAgent* param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false);
-
-                // Get parameter 2 off the stack.
-                AIState* param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false);
-
-                // Get parameter 3 off the stack.
-                float param3 = (float)luaL_checknumber(state, 4);
-
-                AIState::Listener* instance = getInstance(state);
-                instance->stateUpdate(param1, param2, param3);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateListener_stateUpdate - 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;
-}
-
-}
+#include "Base.h"
+#include "ScriptController.h"
+#include "lua_AIStateListener.h"
+#include "AIState.h"
+#include "AIStateMachine.h"
+#include "Base.h"
+#include "Game.h"
+#include "Ref.h"
+
+namespace gameplay
+{
+
+void luaRegister_AIStateListener()
+{
+    const luaL_Reg lua_members[] = 
+    {
+        {"stateEnter", lua_AIStateListener_stateEnter},
+        {"stateExit", lua_AIStateListener_stateExit},
+        {"stateUpdate", lua_AIStateListener_stateUpdate},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+    scopePath.push_back("AIState");
+
+    ScriptUtil::registerClass("AIStateListener", lua_members, lua_AIStateListener__init, lua_AIStateListener__gc, lua_statics, scopePath);
+}
+
+static AIState::Listener* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AIStateListener");
+    luaL_argcheck(state, userdata != NULL, 1, "'AIStateListener' expected.");
+    return (AIState::Listener*)((ScriptUtil::LuaObject*)userdata)->instance;
+}
+
+int lua_AIStateListener__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, "AIStateListener");
+                luaL_argcheck(state, userdata != NULL, 1, "'AIStateListener' expected.");
+                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
+                if (object->owns)
+                {
+                    AIState::Listener* instance = (AIState::Listener*)object->instance;
+                    SAFE_DELETE(instance);
+                }
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIStateListener__gc - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AIStateListener__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:
+        {
+            void* returnPtr = (void*)new AIState::Listener();
+            if (returnPtr)
+            {
+                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                object->instance = returnPtr;
+                object->owns = true;
+                luaL_getmetatable(state, "AIStateListener");
+                lua_setmetatable(state, -2);
+            }
+            else
+            {
+                lua_pushnil(state);
+            }
+
+            return 1;
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 0).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_AIStateListener_stateEnter(lua_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, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
+                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                AIAgent* param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false);
+
+                // Get parameter 2 off the stack.
+                AIState* param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false);
+
+                AIState::Listener* instance = getInstance(state);
+                instance->stateEnter(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIStateListener_stateEnter - 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_AIStateListener_stateExit(lua_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, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
+                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                AIAgent* param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false);
+
+                // Get parameter 2 off the stack.
+                AIState* param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false);
+
+                AIState::Listener* instance = getInstance(state);
+                instance->stateExit(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIStateListener_stateExit - 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_AIStateListener_stateUpdate(lua_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_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
+                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL) &&
+                lua_type(state, 4) == LUA_TNUMBER)
+            {
+                // Get parameter 1 off the stack.
+                AIAgent* param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false);
+
+                // Get parameter 2 off the stack.
+                AIState* param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false);
+
+                // Get parameter 3 off the stack.
+                float param3 = (float)luaL_checknumber(state, 4);
+
+                AIState::Listener* instance = getInstance(state);
+                instance->stateUpdate(param1, param2, param3);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIStateListener_stateUpdate - 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;
+}
+
+}

+ 18 - 18
gameplay/src/lua/lua_AIStateListener.h

@@ -1,18 +1,18 @@
-#ifndef LUA_AISTATELISTENER_H_
-#define LUA_AISTATELISTENER_H_
-
-namespace gameplay
-{
-
-// Lua bindings for AIState::Listener.
-int lua_AIStateListener__gc(lua_State* state);
-int lua_AIStateListener__init(lua_State* state);
-int lua_AIStateListener_stateEnter(lua_State* state);
-int lua_AIStateListener_stateExit(lua_State* state);
-int lua_AIStateListener_stateUpdate(lua_State* state);
-
-void luaRegister_AIStateListener();
-
-}
-
-#endif
+#ifndef LUA_AISTATELISTENER_H_
+#define LUA_AISTATELISTENER_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AIState::Listener.
+int lua_AIStateListener__gc(lua_State* state);
+int lua_AIStateListener__init(lua_State* state);
+int lua_AIStateListener_stateEnter(lua_State* state);
+int lua_AIStateListener_stateExit(lua_State* state);
+int lua_AIStateListener_stateUpdate(lua_State* state);
+
+void luaRegister_AIStateListener();
+
+}
+
+#endif

+ 343 - 343
gameplay/src/lua/lua_AIStateMachine.cpp

@@ -1,343 +1,343 @@
-#include "Base.h"
-#include "ScriptController.h"
-#include "lua_AIStateMachine.h"
-#include "AIAgent.h"
-#include "AIMessage.h"
-#include "AIStateMachine.h"
-#include "Base.h"
-#include "Game.h"
-
-namespace gameplay
-{
-
-void luaRegister_AIStateMachine()
-{
-    const luaL_Reg lua_members[] = 
-    {
-        {"addState", lua_AIStateMachine_addState},
-        {"getActiveState", lua_AIStateMachine_getActiveState},
-        {"getAgent", lua_AIStateMachine_getAgent},
-        {"getState", lua_AIStateMachine_getState},
-        {"removeState", lua_AIStateMachine_removeState},
-        {"setState", lua_AIStateMachine_setState},
-        {NULL, NULL}
-    };
-    const luaL_Reg* lua_statics = NULL;
-    std::vector<std::string> scopePath;
-
-    ScriptUtil::registerClass("AIStateMachine", lua_members, NULL, NULL, lua_statics, scopePath);
-}
-
-static AIStateMachine* getInstance(lua_State* state)
-{
-    void* userdata = luaL_checkudata(state, 1, "AIStateMachine");
-    luaL_argcheck(state, userdata != NULL, 1, "'AIStateMachine' expected.");
-    return (AIStateMachine*)((ScriptUtil::LuaObject*)userdata)->instance;
-}
-
-int lua_AIStateMachine_addState(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = ScriptUtil::getString(2, false);
-
-                AIStateMachine* instance = getInstance(state);
-                void* returnPtr = (void*)instance->addState(param1);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AIState");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                AIState* param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false);
-
-                AIStateMachine* instance = getInstance(state);
-                instance->addState(param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateMachine_addState - 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_AIStateMachine_getActiveState(lua_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))
-            {
-                AIStateMachine* instance = getInstance(state);
-                void* returnPtr = (void*)instance->getActiveState();
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AIState");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateMachine_getActiveState - 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_AIStateMachine_getAgent(lua_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))
-            {
-                AIStateMachine* instance = getInstance(state);
-                void* returnPtr = (void*)instance->getAgent();
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AIAgent");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateMachine_getAgent - 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_AIStateMachine_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 2:
-        {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = ScriptUtil::getString(2, false);
-
-                AIStateMachine* instance = getInstance(state);
-                void* returnPtr = (void*)instance->getState(param1);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AIState");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateMachine_getState - 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_AIStateMachine_removeState(lua_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 || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                AIState* param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false);
-
-                AIStateMachine* instance = getInstance(state);
-                instance->removeState(param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateMachine_removeState - 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_AIStateMachine_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 || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = ScriptUtil::getString(2, false);
-
-                AIStateMachine* instance = getInstance(state);
-                void* returnPtr = (void*)instance->setState(param1);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AIState");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                AIState* param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false);
-
-                AIStateMachine* instance = getInstance(state);
-                bool result = instance->setState(param1);
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateMachine_setState - 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;
-}
-
-}
+#include "Base.h"
+#include "ScriptController.h"
+#include "lua_AIStateMachine.h"
+#include "AIAgent.h"
+#include "AIMessage.h"
+#include "AIStateMachine.h"
+#include "Base.h"
+#include "Game.h"
+
+namespace gameplay
+{
+
+void luaRegister_AIStateMachine()
+{
+    const luaL_Reg lua_members[] = 
+    {
+        {"addState", lua_AIStateMachine_addState},
+        {"getActiveState", lua_AIStateMachine_getActiveState},
+        {"getAgent", lua_AIStateMachine_getAgent},
+        {"getState", lua_AIStateMachine_getState},
+        {"removeState", lua_AIStateMachine_removeState},
+        {"setState", lua_AIStateMachine_setState},
+        {NULL, NULL}
+    };
+    const luaL_Reg* lua_statics = NULL;
+    std::vector<std::string> scopePath;
+
+    ScriptUtil::registerClass("AIStateMachine", lua_members, NULL, NULL, lua_statics, scopePath);
+}
+
+static AIStateMachine* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "AIStateMachine");
+    luaL_argcheck(state, userdata != NULL, 1, "'AIStateMachine' expected.");
+    return (AIStateMachine*)((ScriptUtil::LuaObject*)userdata)->instance;
+}
+
+int lua_AIStateMachine_addState(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = ScriptUtil::getString(2, false);
+
+                AIStateMachine* instance = getInstance(state);
+                void* returnPtr = (void*)instance->addState(param1);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "AIState");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                AIState* param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false);
+
+                AIStateMachine* instance = getInstance(state);
+                instance->addState(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIStateMachine_addState - 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_AIStateMachine_getActiveState(lua_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))
+            {
+                AIStateMachine* instance = getInstance(state);
+                void* returnPtr = (void*)instance->getActiveState();
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "AIState");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIStateMachine_getActiveState - 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_AIStateMachine_getAgent(lua_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))
+            {
+                AIStateMachine* instance = getInstance(state);
+                void* returnPtr = (void*)instance->getAgent();
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "AIAgent");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIStateMachine_getAgent - 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_AIStateMachine_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 2:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = ScriptUtil::getString(2, false);
+
+                AIStateMachine* instance = getInstance(state);
+                void* returnPtr = (void*)instance->getState(param1);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "AIState");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIStateMachine_getState - 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_AIStateMachine_removeState(lua_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 || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                AIState* param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false);
+
+                AIStateMachine* instance = getInstance(state);
+                instance->removeState(param1);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIStateMachine_removeState - 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_AIStateMachine_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 || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                const char* param1 = ScriptUtil::getString(2, false);
+
+                AIStateMachine* instance = getInstance(state);
+                void* returnPtr = (void*)instance->setState(param1);
+                if (returnPtr)
+                {
+                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                    object->instance = returnPtr;
+                    object->owns = false;
+                    luaL_getmetatable(state, "AIState");
+                    lua_setmetatable(state, -2);
+                }
+                else
+                {
+                    lua_pushnil(state);
+                }
+
+                return 1;
+            }
+            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                AIState* param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false);
+
+                AIStateMachine* instance = getInstance(state);
+                bool result = instance->setState(param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_AIStateMachine_setState - 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;
+}
+
+}

+ 19 - 19
gameplay/src/lua/lua_AIStateMachine.h

@@ -1,19 +1,19 @@
-#ifndef LUA_AISTATEMACHINE_H_
-#define LUA_AISTATEMACHINE_H_
-
-namespace gameplay
-{
-
-// Lua bindings for AIStateMachine.
-int lua_AIStateMachine_addState(lua_State* state);
-int lua_AIStateMachine_getActiveState(lua_State* state);
-int lua_AIStateMachine_getAgent(lua_State* state);
-int lua_AIStateMachine_getState(lua_State* state);
-int lua_AIStateMachine_removeState(lua_State* state);
-int lua_AIStateMachine_setState(lua_State* state);
-
-void luaRegister_AIStateMachine();
-
-}
-
-#endif
+#ifndef LUA_AISTATEMACHINE_H_
+#define LUA_AISTATEMACHINE_H_
+
+namespace gameplay
+{
+
+// Lua bindings for AIStateMachine.
+int lua_AIStateMachine_addState(lua_State* state);
+int lua_AIStateMachine_getActiveState(lua_State* state);
+int lua_AIStateMachine_getAgent(lua_State* state);
+int lua_AIStateMachine_getState(lua_State* state);
+int lua_AIStateMachine_removeState(lua_State* state);
+int lua_AIStateMachine_setState(lua_State* state);
+
+void luaRegister_AIStateMachine();
+
+}
+
+#endif

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

@@ -752,7 +752,7 @@ int lua_AudioSource_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "AudioSource");
                     lua_setmetatable(state, -2);
                 }
@@ -773,7 +773,7 @@ int lua_AudioSource_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "AudioSource");
                     lua_setmetatable(state, -2);
                 }

+ 6 - 6
gameplay/src/lua/lua_Bundle.cpp

@@ -298,7 +298,7 @@ int lua_Bundle_loadFont(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Font");
                     lua_setmetatable(state, -2);
                 }
@@ -348,7 +348,7 @@ int lua_Bundle_loadMesh(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Mesh");
                     lua_setmetatable(state, -2);
                 }
@@ -398,7 +398,7 @@ int lua_Bundle_loadNode(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Node");
                     lua_setmetatable(state, -2);
                 }
@@ -444,7 +444,7 @@ int lua_Bundle_loadScene(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Scene");
                     lua_setmetatable(state, -2);
                 }
@@ -476,7 +476,7 @@ int lua_Bundle_loadScene(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Scene");
                     lua_setmetatable(state, -2);
                 }
@@ -558,7 +558,7 @@ int lua_Bundle_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Bundle");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_CheckBox.cpp

@@ -4507,7 +4507,7 @@ int lua_CheckBox_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "CheckBox");
                     lua_setmetatable(state, -2);
                 }

+ 2 - 2
gameplay/src/lua/lua_Container.cpp

@@ -4713,7 +4713,7 @@ int lua_Container_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Container");
                     lua_setmetatable(state, -2);
                 }
@@ -4751,7 +4751,7 @@ int lua_Container_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Container");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_Curve.cpp

@@ -544,7 +544,7 @@ int lua_Curve_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Curve");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_DepthStencilTarget.cpp

@@ -290,7 +290,7 @@ int lua_DepthStencilTarget_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "DepthStencilTarget");
                     lua_setmetatable(state, -2);
                 }

+ 3 - 54
gameplay/src/lua/lua_Font.cpp

@@ -8,7 +8,6 @@
 #include "Game.h"
 #include "Ref.h"
 #include "lua_FontJustify.h"
-#include "lua_FontStyle.h"
 
 namespace gameplay
 {
@@ -1607,7 +1606,7 @@ int lua_Font_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Font");
                     lua_setmetatable(state, -2);
                 }
@@ -1641,57 +1640,7 @@ int lua_Font_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Font");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
-                }
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Font_static_create - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        case 6:
-        {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                (lua_type(state, 4) == LUA_TUSERDATA || lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TNIL) &&
-                lua_type(state, 5) == LUA_TNUMBER &&
-                (lua_type(state, 6) == LUA_TUSERDATA || lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                const char* param1 = ScriptUtil::getString(1, false);
-
-                // Get parameter 2 off the stack.
-                Font::Style param2 = (Font::Style)lua_enumFromString_FontStyle(luaL_checkstring(state, 2));
-
-                // Get parameter 3 off the stack.
-                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 3);
-
-                // Get parameter 4 off the stack.
-                Font::Glyph* param4 = ScriptUtil::getObjectPointer<Font::Glyph>(4, "FontGlyph", false);
-
-                // Get parameter 5 off the stack.
-                int param5 = (int)luaL_checkint(state, 5);
-
-                // Get parameter 6 off the stack.
-                Texture* param6 = ScriptUtil::getObjectPointer<Texture>(6, "Texture", false);
-
-                void* returnPtr = (void*)Font::create(param1, param2, param3, param4, param5, param6);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Font");
                     lua_setmetatable(state, -2);
                 }
@@ -1711,7 +1660,7 @@ int lua_Font_static_create(lua_State* state)
         }
         default:
         {
-            lua_pushstring(state, "Invalid number of parameters (expected 1, 2 or 6).");
+            lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
             lua_error(state);
             break;
         }

+ 0 - 202
gameplay/src/lua/lua_FontGlyph.cpp

@@ -1,202 +0,0 @@
-#include "Base.h"
-#include "ScriptController.h"
-#include "lua_FontGlyph.h"
-#include "Base.h"
-#include "Bundle.h"
-#include "FileSystem.h"
-#include "Font.h"
-#include "Game.h"
-#include "Ref.h"
-#include "lua_FontJustify.h"
-#include "lua_FontStyle.h"
-
-namespace gameplay
-{
-
-void luaRegister_FontGlyph()
-{
-    const luaL_Reg lua_members[] = 
-    {
-        {"code", lua_FontGlyph_code},
-        {"uvs", lua_FontGlyph_uvs},
-        {"width", lua_FontGlyph_width},
-        {NULL, NULL}
-    };
-    const luaL_Reg* lua_statics = NULL;
-    std::vector<std::string> scopePath;
-    scopePath.push_back("Font");
-
-    ScriptUtil::registerClass("FontGlyph", lua_members, lua_FontGlyph__init, lua_FontGlyph__gc, lua_statics, scopePath);
-}
-
-static Font::Glyph* getInstance(lua_State* state)
-{
-    void* userdata = luaL_checkudata(state, 1, "FontGlyph");
-    luaL_argcheck(state, userdata != NULL, 1, "'FontGlyph' expected.");
-    return (Font::Glyph*)((ScriptUtil::LuaObject*)userdata)->instance;
-}
-
-int lua_FontGlyph__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, "FontGlyph");
-                luaL_argcheck(state, userdata != NULL, 1, "'FontGlyph' expected.");
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
-                if (object->owns)
-                {
-                    Font::Glyph* instance = (Font::Glyph*)object->instance;
-                    SAFE_DELETE(instance);
-                }
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_FontGlyph__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_FontGlyph__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:
-        {
-            void* returnPtr = (void*)new Font::Glyph();
-            if (returnPtr)
-            {
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                object->instance = returnPtr;
-                object->owns = true;
-                luaL_getmetatable(state, "FontGlyph");
-                lua_setmetatable(state, -2);
-            }
-            else
-            {
-                lua_pushnil(state);
-            }
-
-            return 1;
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 0).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_FontGlyph_code(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);
-    }
-
-    Font::Glyph* instance = getInstance(state);
-    if (lua_gettop(state) == 2)
-    {
-        // Get parameter 2 off the stack.
-        unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
-
-        instance->code = param2;
-        return 0;
-    }
-    else
-    {
-        unsigned int result = instance->code;
-
-        // Push the return value onto the stack.
-        lua_pushunsigned(state, result);
-
-        return 1;
-    }
-}
-
-int lua_FontGlyph_uvs(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);
-    }
-
-    Font::Glyph* instance = getInstance(state);
-    if (lua_gettop(state) == 2)
-    {
-        // Get parameter 2 off the stack.
-        float* param2 = ScriptUtil::getFloatPointer(2);
-
-        memcpy(instance->uvs, param2, sizeof(float) * 4);
-        return 0;
-    }
-    else
-    {
-        float* result = instance->uvs;
-
-        // Push the return value onto the stack.
-        lua_pushlightuserdata(state, result);
-        return 1;
-    }
-}
-
-int lua_FontGlyph_width(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);
-    }
-
-    Font::Glyph* instance = getInstance(state);
-    if (lua_gettop(state) == 2)
-    {
-        // Get parameter 2 off the stack.
-        unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
-
-        instance->width = param2;
-        return 0;
-    }
-    else
-    {
-        unsigned int result = instance->width;
-
-        // Push the return value onto the stack.
-        lua_pushunsigned(state, result);
-
-        return 1;
-    }
-}
-
-}

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

@@ -1,18 +0,0 @@
-#ifndef LUA_FONTGLYPH_H_
-#define LUA_FONTGLYPH_H_
-
-namespace gameplay
-{
-
-// Lua bindings for Font::Glyph.
-int lua_FontGlyph__gc(lua_State* state);
-int lua_FontGlyph__init(lua_State* state);
-int lua_FontGlyph_code(lua_State* state);
-int lua_FontGlyph_uvs(lua_State* state);
-int lua_FontGlyph_width(lua_State* state);
-
-void luaRegister_FontGlyph();
-
-}
-
-#endif

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

@@ -8,7 +8,6 @@
 #include "Game.h"
 #include "Ref.h"
 #include "lua_FontJustify.h"
-#include "lua_FontStyle.h"
 
 namespace gameplay
 {

+ 3 - 3
gameplay/src/lua/lua_Form.cpp

@@ -4835,7 +4835,7 @@ int lua_Form_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Form");
                     lua_setmetatable(state, -2);
                 }
@@ -4869,7 +4869,7 @@ int lua_Form_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Form");
                     lua_setmetatable(state, -2);
                 }
@@ -4907,7 +4907,7 @@ int lua_Form_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Form");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_FrameBuffer.cpp

@@ -613,7 +613,7 @@ int lua_FrameBuffer_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "FrameBuffer");
                     lua_setmetatable(state, -2);
                 }

+ 5 - 10
gameplay/src/lua/lua_Global.cpp

@@ -12,7 +12,7 @@ void luaRegister_lua_Global()
     ScriptUtil::registerFunction("printError", lua__printError);
 
     std::map<std::string, std::vector<std::string> > hierarchy;
-    hierarchy["AnimationClip::Listener"].push_back("classgameplay_1_1_script_listener");
+    hierarchy["AnimationClip::Listener"].push_back("ScriptListener");
     hierarchy["AnimationTarget"].push_back("Button");
     hierarchy["AnimationTarget"].push_back("CheckBox");
     hierarchy["AnimationTarget"].push_back("Container");
@@ -27,7 +27,6 @@ void luaRegister_lua_Global()
     hierarchy["AnimationTarget"].push_back("Slider");
     hierarchy["AnimationTarget"].push_back("TextBox");
     hierarchy["AnimationTarget"].push_back("Transform");
-    hierarchy["AnimationTarget"].push_back("classgameplay_1_1_theme_1_1_style_1_1_overlay");
     hierarchy["Button"].push_back("CheckBox");
     hierarchy["Button"].push_back("RadioButton");
     hierarchy["Container"].push_back("Form");
@@ -40,7 +39,7 @@ void luaRegister_lua_Global()
     hierarchy["Control"].push_back("RadioButton");
     hierarchy["Control"].push_back("Slider");
     hierarchy["Control"].push_back("TextBox");
-    hierarchy["Control::Listener"].push_back("classgameplay_1_1_script_listener");
+    hierarchy["Control::Listener"].push_back("ScriptListener");
     hierarchy["Label"].push_back("Button");
     hierarchy["Label"].push_back("CheckBox");
     hierarchy["Label"].push_back("RadioButton");
@@ -53,13 +52,13 @@ void luaRegister_lua_Global()
     hierarchy["PhysicsCollisionObject"].push_back("PhysicsCharacter");
     hierarchy["PhysicsCollisionObject"].push_back("PhysicsGhostObject");
     hierarchy["PhysicsCollisionObject"].push_back("PhysicsRigidBody");
-    hierarchy["PhysicsCollisionObject::CollisionListener"].push_back("classgameplay_1_1_script_listener");
+    hierarchy["PhysicsCollisionObject::CollisionListener"].push_back("ScriptListener");
     hierarchy["PhysicsConstraint"].push_back("PhysicsFixedConstraint");
     hierarchy["PhysicsConstraint"].push_back("PhysicsGenericConstraint");
     hierarchy["PhysicsConstraint"].push_back("PhysicsHingeConstraint");
     hierarchy["PhysicsConstraint"].push_back("PhysicsSocketConstraint");
     hierarchy["PhysicsConstraint"].push_back("PhysicsSpringConstraint");
-    hierarchy["PhysicsController::Listener"].push_back("classgameplay_1_1_script_listener");
+    hierarchy["PhysicsController::Listener"].push_back("ScriptListener");
     hierarchy["PhysicsGenericConstraint"].push_back("PhysicsFixedConstraint");
     hierarchy["PhysicsGenericConstraint"].push_back("PhysicsSpringConstraint");
     hierarchy["PhysicsGhostObject"].push_back("PhysicsCharacter");
@@ -111,10 +110,6 @@ void luaRegister_lua_Global()
     hierarchy["Ref"].push_back("Theme::ThemeImage");
     hierarchy["Ref"].push_back("VertexAttributeBinding");
     hierarchy["Ref"].push_back("VerticalLayout");
-    hierarchy["Ref"].push_back("classgameplay_1_1_material_parameter_1_1_method_binding");
-    hierarchy["Ref"].push_back("classgameplay_1_1_theme_1_1_image_list");
-    hierarchy["Ref"].push_back("classgameplay_1_1_theme_1_1_skin");
-    hierarchy["Ref"].push_back("classgameplay_1_1_theme_1_1_style_1_1_overlay");
     hierarchy["RenderState"].push_back("Material");
     hierarchy["RenderState"].push_back("Pass");
     hierarchy["RenderState"].push_back("Technique");
@@ -127,7 +122,7 @@ void luaRegister_lua_Global()
     hierarchy["Transform::Listener"].push_back("PhysicsCharacter");
     hierarchy["Transform::Listener"].push_back("PhysicsGhostObject");
     hierarchy["Transform::Listener"].push_back("PhysicsRigidBody");
-    hierarchy["Transform::Listener"].push_back("classgameplay_1_1_script_listener");
+    hierarchy["Transform::Listener"].push_back("ScriptListener");
     ScriptUtil::setGlobalHierarchy(hierarchy);
 
     // Register enumeration AIMessage::ParameterType.

+ 1 - 1
gameplay/src/lua/lua_Image.cpp

@@ -316,7 +316,7 @@ int lua_Image_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Image");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_Joystick.cpp

@@ -4471,7 +4471,7 @@ int lua_Joystick_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Joystick");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_Label.cpp

@@ -4338,7 +4338,7 @@ int lua_Label_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Label");
                     lua_setmetatable(state, -2);
                 }

+ 5 - 5
gameplay/src/lua/lua_Material.cpp

@@ -645,7 +645,7 @@ int lua_Material_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Material");
                     lua_setmetatable(state, -2);
                 }
@@ -666,7 +666,7 @@ int lua_Material_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Material");
                     lua_setmetatable(state, -2);
                 }
@@ -687,7 +687,7 @@ int lua_Material_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Material");
                     lua_setmetatable(state, -2);
                 }
@@ -721,7 +721,7 @@ int lua_Material_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Material");
                     lua_setmetatable(state, -2);
                 }
@@ -759,7 +759,7 @@ int lua_Material_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Material");
                     lua_setmetatable(state, -2);
                 }

+ 6 - 6
gameplay/src/lua/lua_MeshBatch.cpp

@@ -332,7 +332,7 @@ int lua_MeshBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "MeshBatch");
                     lua_setmetatable(state, -2);
                 }
@@ -365,7 +365,7 @@ int lua_MeshBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "MeshBatch");
                     lua_setmetatable(state, -2);
                 }
@@ -411,7 +411,7 @@ int lua_MeshBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "MeshBatch");
                     lua_setmetatable(state, -2);
                 }
@@ -448,7 +448,7 @@ int lua_MeshBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "MeshBatch");
                     lua_setmetatable(state, -2);
                 }
@@ -498,7 +498,7 @@ int lua_MeshBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "MeshBatch");
                     lua_setmetatable(state, -2);
                 }
@@ -539,7 +539,7 @@ int lua_MeshBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "MeshBatch");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_Model.cpp

@@ -784,7 +784,7 @@ int lua_Model_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Model");
                     lua_setmetatable(state, -2);
                 }

+ 2 - 2
gameplay/src/lua/lua_Node.cpp

@@ -5828,7 +5828,7 @@ int lua_Node_static_create(lua_State* state)
             {
                 ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                 object->instance = returnPtr;
-                object->owns = false;
+                object->owns = true;
                 luaL_getmetatable(state, "Node");
                 lua_setmetatable(state, -2);
             }
@@ -5852,7 +5852,7 @@ int lua_Node_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Node");
                     lua_setmetatable(state, -2);
                 }

+ 3 - 3
gameplay/src/lua/lua_ParticleEmitter.cpp

@@ -2452,7 +2452,7 @@ int lua_ParticleEmitter_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "ParticleEmitter");
                     lua_setmetatable(state, -2);
                 }
@@ -2473,7 +2473,7 @@ int lua_ParticleEmitter_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "ParticleEmitter");
                     lua_setmetatable(state, -2);
                 }
@@ -2511,7 +2511,7 @@ int lua_ParticleEmitter_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "ParticleEmitter");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_Properties.cpp

@@ -1021,7 +1021,7 @@ int lua_Properties_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Properties");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_RadioButton.cpp

@@ -4468,7 +4468,7 @@ int lua_RadioButton_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "RadioButton");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_RenderStateStateBlock.cpp

@@ -513,7 +513,7 @@ int lua_RenderStateStateBlock_static_create(lua_State* state)
             {
                 ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                 object->instance = returnPtr;
-                object->owns = false;
+                object->owns = true;
                 luaL_getmetatable(state, "RenderStateStateBlock");
                 lua_setmetatable(state, -2);
             }

+ 1 - 1
gameplay/src/lua/lua_RenderTarget.cpp

@@ -294,7 +294,7 @@ int lua_RenderTarget_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "RenderTarget");
                     lua_setmetatable(state, -2);
                 }

+ 0 - 109
gameplay/src/lua/lua_SceneLoader.cpp

@@ -1,109 +0,0 @@
-#include "Base.h"
-#include "ScriptController.h"
-#include "lua_SceneLoader.h"
-#include "AudioSource.h"
-#include "Base.h"
-#include "Bundle.h"
-#include "Game.h"
-#include "SceneLoader.h"
-
-namespace gameplay
-{
-
-void luaRegister_SceneLoader()
-{
-    const luaL_Reg lua_members[] = 
-    {
-        {NULL, NULL}
-    };
-    const luaL_Reg* lua_statics = NULL;
-    std::vector<std::string> scopePath;
-
-    ScriptUtil::registerClass("SceneLoader", lua_members, lua_SceneLoader__init, lua_SceneLoader__gc, lua_statics, scopePath);
-}
-
-static SceneLoader* getInstance(lua_State* state)
-{
-    void* userdata = luaL_checkudata(state, 1, "SceneLoader");
-    luaL_argcheck(state, userdata != NULL, 1, "'SceneLoader' expected.");
-    return (SceneLoader*)((ScriptUtil::LuaObject*)userdata)->instance;
-}
-
-int lua_SceneLoader__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, "SceneLoader");
-                luaL_argcheck(state, userdata != NULL, 1, "'SceneLoader' expected.");
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)userdata;
-                if (object->owns)
-                {
-                    SceneLoader* instance = (SceneLoader*)object->instance;
-                    SAFE_DELETE(instance);
-                }
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_SceneLoader__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_SceneLoader__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:
-        {
-            void* returnPtr = (void*)new SceneLoader();
-            if (returnPtr)
-            {
-                ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                object->instance = returnPtr;
-                object->owns = true;
-                luaL_getmetatable(state, "SceneLoader");
-                lua_setmetatable(state, -2);
-            }
-            else
-            {
-                lua_pushnil(state);
-            }
-
-            return 1;
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 0).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-}

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

@@ -1,15 +0,0 @@
-#ifndef LUA_SCENELOADER_H_
-#define LUA_SCENELOADER_H_
-
-namespace gameplay
-{
-
-// Lua bindings for SceneLoader.
-int lua_SceneLoader__gc(lua_State* state);
-int lua_SceneLoader__init(lua_State* state);
-
-void luaRegister_SceneLoader();
-
-}
-
-#endif

+ 1 - 1
gameplay/src/lua/lua_Slider.cpp

@@ -4647,7 +4647,7 @@ int lua_Slider_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Slider");
                     lua_setmetatable(state, -2);
                 }

+ 6 - 6
gameplay/src/lua/lua_SpriteBatch.cpp

@@ -1003,7 +1003,7 @@ int lua_SpriteBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "SpriteBatch");
                     lua_setmetatable(state, -2);
                 }
@@ -1024,7 +1024,7 @@ int lua_SpriteBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "SpriteBatch");
                     lua_setmetatable(state, -2);
                 }
@@ -1058,7 +1058,7 @@ int lua_SpriteBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "SpriteBatch");
                     lua_setmetatable(state, -2);
                 }
@@ -1083,7 +1083,7 @@ int lua_SpriteBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "SpriteBatch");
                     lua_setmetatable(state, -2);
                 }
@@ -1121,7 +1121,7 @@ int lua_SpriteBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "SpriteBatch");
                     lua_setmetatable(state, -2);
                 }
@@ -1150,7 +1150,7 @@ int lua_SpriteBatch_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "SpriteBatch");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_TextBox.cpp

@@ -4377,7 +4377,7 @@ int lua_TextBox_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "TextBox");
                     lua_setmetatable(state, -2);
                 }

+ 6 - 6
gameplay/src/lua/lua_Texture.cpp

@@ -563,7 +563,7 @@ int lua_Texture_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Texture");
                     lua_setmetatable(state, -2);
                 }
@@ -584,7 +584,7 @@ int lua_Texture_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Texture");
                     lua_setmetatable(state, -2);
                 }
@@ -618,7 +618,7 @@ int lua_Texture_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Texture");
                     lua_setmetatable(state, -2);
                 }
@@ -643,7 +643,7 @@ int lua_Texture_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Texture");
                     lua_setmetatable(state, -2);
                 }
@@ -685,7 +685,7 @@ int lua_Texture_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Texture");
                     lua_setmetatable(state, -2);
                 }
@@ -731,7 +731,7 @@ int lua_Texture_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Texture");
                     lua_setmetatable(state, -2);
                 }

+ 3 - 3
gameplay/src/lua/lua_TextureSampler.cpp

@@ -374,7 +374,7 @@ int lua_TextureSampler_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "TextureSampler");
                     lua_setmetatable(state, -2);
                 }
@@ -395,7 +395,7 @@ int lua_TextureSampler_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "TextureSampler");
                     lua_setmetatable(state, -2);
                 }
@@ -429,7 +429,7 @@ int lua_TextureSampler_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "TextureSampler");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_Theme.cpp

@@ -299,7 +299,7 @@ int lua_Theme_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "Theme");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_VertexAttributeBinding.cpp

@@ -242,7 +242,7 @@ int lua_VertexAttributeBinding_static_create(lua_State* state)
                 {
                     ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                     object->instance = returnPtr;
-                    object->owns = false;
+                    object->owns = true;
                     luaL_getmetatable(state, "VertexAttributeBinding");
                     lua_setmetatable(state, -2);
                 }

+ 1 - 1
gameplay/src/lua/lua_VerticalLayout.cpp

@@ -314,7 +314,7 @@ int lua_VerticalLayout_static_create(lua_State* state)
             {
                 ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
                 object->instance = returnPtr;
-                object->owns = false;
+                object->owns = true;
                 luaL_getmetatable(state, "VerticalLayout");
                 lua_setmetatable(state, -2);
             }

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

@@ -39,7 +39,6 @@ void lua_RegisterAllBindings()
     luaRegister_FileSystem();
     luaRegister_FlowLayout();
     luaRegister_Font();
-    luaRegister_FontGlyph();
     luaRegister_FontText();
     luaRegister_Form();
     luaRegister_FrameBuffer();
@@ -98,7 +97,6 @@ void lua_RegisterAllBindings()
     luaRegister_RenderStateStateBlock();
     luaRegister_RenderTarget();
     luaRegister_Scene();
-    luaRegister_SceneLoader();
     luaRegister_ScreenDisplayer();
     luaRegister_ScriptController();
     luaRegister_Slider();

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

@@ -34,7 +34,6 @@
 #include "lua_FileSystem.h"
 #include "lua_FlowLayout.h"
 #include "lua_Font.h"
-#include "lua_FontGlyph.h"
 #include "lua_FontText.h"
 #include "lua_Form.h"
 #include "lua_FrameBuffer.h"
@@ -93,7 +92,6 @@
 #include "lua_RenderStateStateBlock.h"
 #include "lua_RenderTarget.h"
 #include "lua_Scene.h"
-#include "lua_SceneLoader.h"
 #include "lua_ScreenDisplayer.h"
 #include "lua_ScriptController.h"
 #include "lua_Slider.h"