Просмотр исходного кода

Merge remote-tracking branch 'upstream/next' into next

Marcin Jakubowski 13 лет назад
Родитель
Сommit
253cf28141
100 измененных файлов с 6594 добавлено и 5964 удалено
  1. 9 2
      CMakeLists.txt
  2. 5 4
      gameplay-encoder/CMakeLists.txt
  3. 2 2
      gameplay-encoder/gameplay-encoder.vcxproj
  4. 4 2
      gameplay-encoder/gameplay-encoder.vcxproj.user
  5. 1 1
      gameplay-encoder/src/DAEOptimizer.cpp
  6. 44 49
      gameplay-encoder/src/DAESceneEncoder.cpp
  7. 16 16
      gameplay-encoder/src/DAEUtil.cpp
  8. 10 17
      gameplay-encoder/src/FBXSceneEncoder.cpp
  9. 52 0
      gameplay-luagen/CMakeLists.txt
  10. 75 36
      gameplay-luagen/src/FunctionBinding.cpp
  11. 3 0
      gameplay-luagen/src/main.cpp
  12. 8 2
      gameplay-template/gameplay-template-CMakeLists.txt
  13. 153 5
      gameplay-template/gameplay-template.vcxproj
  14. 15 3
      gameplay-template/gameplay-template.vcxproj.user
  15. 1 1
      gameplay-template/res/box.material
  16. 2 2
      gameplay-template/res/colored.vert
  17. 132 75
      gameplay.sln
  18. 13 13
      gameplay/CMakeLists.txt
  19. 126 6
      gameplay/gameplay.vcxproj
  20. 2 2
      gameplay/res/shaders/colored.vert
  21. 2 2
      gameplay/res/shaders/lib/attributes-skinning.vert
  22. 2 2
      gameplay/res/shaders/textured-bumped.vert
  23. 2 2
      gameplay/res/shaders/textured.vert
  24. 1 2
      gameplay/src/AbsoluteLayout.cpp
  25. 1 1
      gameplay/src/Animation.cpp
  26. 8 6
      gameplay/src/AnimationClip.cpp
  27. 8 9
      gameplay/src/Bundle.cpp
  28. 3 4
      gameplay/src/Container.cpp
  29. 1 1
      gameplay/src/Effect.cpp
  30. 1 2
      gameplay/src/FlowLayout.cpp
  31. 21 21
      gameplay/src/Font.cpp
  32. 1 1
      gameplay/src/Font.h
  33. 0 10
      gameplay/src/FrameBuffer.cpp
  34. 1 1
      gameplay/src/Game.cpp
  35. 1 1
      gameplay/src/Game.inl
  36. 1 1
      gameplay/src/Image.cpp
  37. 3 3
      gameplay/src/Material.cpp
  38. 6 7
      gameplay/src/MeshSkin.cpp
  39. 78 35
      gameplay/src/Model.cpp
  40. 1 1
      gameplay/src/Node.cpp
  41. 5 5
      gameplay/src/PhysicsController.cpp
  42. 2 2
      gameplay/src/PhysicsVehicle.cpp
  43. 1 1
      gameplay/src/PlatformWindows.cpp
  44. 5 8
      gameplay/src/Properties.cpp
  45. 11 7
      gameplay/src/RenderState.cpp
  46. 1 1
      gameplay/src/RenderState.h
  47. 1 0
      gameplay/src/RenderTarget.h
  48. 8 8
      gameplay/src/SceneLoader.cpp
  49. 4 4
      gameplay/src/ScriptController.cpp
  50. 4 2
      gameplay/src/ScriptController.h
  51. 118 56
      gameplay/src/ScriptController.inl
  52. 3 3
      gameplay/src/Technique.cpp
  53. 1 1
      gameplay/src/TextBox.cpp
  54. 4 4
      gameplay/src/Texture.cpp
  55. 6 6
      gameplay/src/Theme.cpp
  56. 3 3
      gameplay/src/Transform.cpp
  57. 4 1
      gameplay/src/Vector3.cpp
  58. 1 1
      gameplay/src/VertexAttributeBinding.cpp
  59. 2 2
      gameplay/src/VertexFormat.cpp
  60. 3 3
      gameplay/src/VerticalLayout.cpp
  61. 43 61
      gameplay/src/lua/lua_AIAgent.cpp
  62. 13 11
      gameplay/src/lua/lua_AIAgentListener.cpp
  63. 23 17
      gameplay/src/lua/lua_AIController.cpp
  64. 64 96
      gameplay/src/lua/lua_AIMessage.cpp
  65. 34 46
      gameplay/src/lua/lua_AIState.cpp
  66. 54 26
      gameplay/src/lua/lua_AIStateListener.cpp
  67. 102 88
      gameplay/src/lua/lua_AIStateMachine.cpp
  68. 15 25
      gameplay/src/lua/lua_AbsoluteLayout.cpp
  69. 124 144
      gameplay/src/lua/lua_Animation.cpp
  70. 176 192
      gameplay/src/lua/lua_AnimationClip.cpp
  71. 13 11
      gameplay/src/lua/lua_AnimationClipListener.cpp
  72. 3 5
      gameplay/src/lua/lua_AnimationController.cpp
  73. 214 206
      gameplay/src/lua/lua_AnimationTarget.cpp
  74. 12 20
      gameplay/src/lua/lua_AnimationValue.cpp
  75. 12 20
      gameplay/src/lua/lua_AudioBuffer.cpp
  76. 3 5
      gameplay/src/lua/lua_AudioController.cpp
  77. 164 156
      gameplay/src/lua/lua_AudioListener.cpp
  78. 140 163
      gameplay/src/lua/lua_AudioSource.cpp
  79. 393 298
      gameplay/src/lua/lua_BoundingBox.cpp
  80. 256 184
      gameplay/src/lua/lua_BoundingSphere.cpp
  81. 39 65
      gameplay/src/lua/lua_Bundle.cpp
  82. 303 361
      gameplay/src/lua/lua_Button.cpp
  83. 146 158
      gameplay/src/lua/lua_Camera.cpp
  84. 303 361
      gameplay/src/lua/lua_CheckBox.cpp
  85. 331 360
      gameplay/src/lua/lua_Container.cpp
  86. 303 361
      gameplay/src/lua/lua_Control.cpp
  87. 13 11
      gameplay/src/lua/lua_ControlListener.cpp
  88. 90 112
      gameplay/src/lua/lua_Curve.cpp
  89. 92 36
      gameplay/src/lua/lua_DepthStencilTarget.cpp
  90. 2 0
      gameplay/src/lua/lua_DepthStencilTarget.h
  91. 519 364
      gameplay/src/lua/lua_Effect.cpp
  92. 51 59
      gameplay/src/lua/lua_FileSystem.cpp
  93. 15 25
      gameplay/src/lua/lua_FlowLayout.cpp
  94. 563 422
      gameplay/src/lua/lua_Font.cpp
  95. 9 15
      gameplay/src/lua/lua_FontText.cpp
  96. 332 361
      gameplay/src/lua/lua_Form.cpp
  97. 128 108
      gameplay/src/lua/lua_FrameBuffer.cpp
  98. 234 185
      gameplay/src/lua/lua_Frustum.cpp
  99. 218 297
      gameplay/src/lua/lua_Game.cpp
  100. 43 61
      gameplay/src/lua/lua_Gamepad.cpp

+ 9 - 2
CMakeLists.txt

@@ -2,15 +2,22 @@ cmake_minimum_required(VERSION 2.6)
 
 project(GamePlay)
 
-set(GAMEPLAY_VERSION 1.5.0)
+set(GAMEPLAY_VERSION 1.6.0)
 set(CMAKE_C_COMPILER_INIT g++)
 
 # debug
 message( "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}" )
-if( "${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG" )
+if ( "${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG" )
     add_definitions(-D_DEBUG)
 endif()
 
+# architecture
+if ( CMAKE_SIZEOF_VOID_P EQUAL 8 )
+set(ARCH_DIR "x64")
+else()
+set(ARCH_DIR "x86")
+endif()
+
 # gameplay library
 add_subdirectory(gameplay)
 

+ 5 - 4
gameplay-encoder/CMakeLists.txt

@@ -9,13 +9,14 @@ include_directories(
     /usr/include
 )
 
+add_definitions(-D_DEBUG)
 add_definitions(-D__linux__ -DNO_BOOST -DNO_ZAE)
 
 link_directories(
-    ${CMAKE_SOURCE_DIR}/external-deps/zlib/lib/linux
-    ${CMAKE_SOURCE_DIR}/external-deps/libpng/lib/linux
-    ${CMAKE_SOURCE_DIR}/external-deps/freetype2/lib/linux
-    ${CMAKE_SOURCE_DIR}/external-deps/collada-dom/lib/linux
+    ${CMAKE_SOURCE_DIR}/external-deps/zlib/lib/linux/${ARCH_DIR}
+    ${CMAKE_SOURCE_DIR}/external-deps/libpng/lib/linux/${ARCH_DIR}
+    ${CMAKE_SOURCE_DIR}/external-deps/freetype2/lib/linux/${ARCH_DIR}
+    ${CMAKE_SOURCE_DIR}/external-deps/collada-dom/lib/linux/${ARCH_DIR}
     /usr/lib
 )
 

+ 2 - 2
gameplay-encoder/gameplay-encoder.vcxproj

@@ -159,7 +159,7 @@
     <Link>
       <SubSystem>Console</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalLibraryDirectories>../external-deps/freetype2/lib/windows;../external-deps/collada-dom/lib/windows;../external-deps/libpng/lib/windows;../external-deps/zlib/lib/windows</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>../external-deps/freetype2/lib/windows/x86;../external-deps/collada-dom/lib/windows/x86;../external-deps/libpng/lib/windows/x86;../external-deps/zlib/lib/windows/x86</AdditionalLibraryDirectories>
       <AdditionalDependencies>freetype245.lib;libcollada14dom22-d.lib;libpng14.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <IgnoreSpecificDefaultLibraries>MSVCRT</IgnoreSpecificDefaultLibraries>
     </Link>
@@ -184,7 +184,7 @@
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <AdditionalDependencies>freetype245.lib;libcollada14dom22-d.lib;libpng14.lib;zlib.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>../external-deps/freetype2/lib/windows;../external-deps/collada-dom/lib/windows;../external-deps/libpng/lib/windows;../external-deps/zlib/lib/windows</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>../external-deps/freetype2/lib/windows/x86;../external-deps/collada-dom/lib/windows/x86;../external-deps/libpng/lib/windows/x86;../external-deps/zlib/lib/windows/x86</AdditionalLibraryDirectories>
       <IgnoreSpecificDefaultLibraries>
       </IgnoreSpecificDefaultLibraries>
     </Link>

+ 4 - 2
gameplay-encoder/gameplay-encoder.vcxproj.user

@@ -4,10 +4,12 @@
     <LocalDebuggerCommandArguments>
     </LocalDebuggerCommandArguments>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
-    <LocalDebuggerEnvironment>PATH=%PATH%;../bin/windows;</LocalDebuggerEnvironment>
+    <LocalDebuggerEnvironment>
+    </LocalDebuggerEnvironment>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <LocalDebuggerEnvironment>PATH=%PATH%;../bin/windows;</LocalDebuggerEnvironment>
+    <LocalDebuggerEnvironment>
+    </LocalDebuggerEnvironment>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
   </PropertyGroup>
 </Project>

+ 1 - 1
gameplay-encoder/src/DAEOptimizer.cpp

@@ -19,7 +19,7 @@ void DAEOptimizer::combineAnimations(const std::string& nodeId, const std::strin
 
     daeSIDResolver resolver(_dom, nodeId.c_str());
     daeElement* element = resolver.getElement();
-    if (element && element->typeID() == COLLADA_TYPE::NODE)
+    if (element && element->typeID() == domNode::ID())
     {
         domNodeRef node = daeSafeCast<domNode>(resolver.getElement());
         getAnimationChannels(node, channels);

+ 44 - 49
gameplay-encoder/src/DAESceneEncoder.cpp

@@ -889,59 +889,54 @@ void DAESceneEncoder::calcTransform(domNode* domNode, Matrix& dstTransform)
     for (size_t i = 0; i < childCount; ++i)
     {
         daeElementRef childElement = children[i];
-        switch (childElement->typeID())
+        daeInt typeID = childElement->typeID();
+        if (typeID == domTranslate::ID())
         {
-            case COLLADA_TYPE::TRANSLATE:
+            domTranslateRef translateNode = daeSafeCast<domTranslate>(childElement);
+            float x = (float)translateNode->getValue().get(0);
+            float y = (float)translateNode->getValue().get(1);
+            float z = (float)translateNode->getValue().get(2);
+            dstTransform.translate(x, y, z);
+        }
+        if (typeID == domRotate::ID())
+        {
+            domRotateRef rotateNode = daeSafeCast<domRotate>(childElement);
+            float x = (float)rotateNode->getValue().get(0);
+            float y = (float)rotateNode->getValue().get(1);
+            float z = (float)rotateNode->getValue().get(2);
+            float angle = MATH_DEG_TO_RAD((float)rotateNode->getValue().get(3)); // COLLADA uses degrees, gameplay uses radians
+            if (x == 1.0f && y == 0.0f && z == 0.0f)
             {
-                domTranslateRef translateNode = daeSafeCast<domTranslate>(childElement);
-                float x = (float)translateNode->getValue().get(0);
-                float y = (float)translateNode->getValue().get(1);
-                float z = (float)translateNode->getValue().get(2);
-                dstTransform.translate(x, y, z);
-                break;
+                dstTransform.rotateX(angle);
             }
-            case COLLADA_TYPE::ROTATE:
+            else if (x == 0.0f && y == 1.0f && z == 0.0f)
             {
-                domRotateRef rotateNode = daeSafeCast<domRotate>(childElement);
-                float x = (float)rotateNode->getValue().get(0);
-                float y = (float)rotateNode->getValue().get(1);
-                float z = (float)rotateNode->getValue().get(2);
-                float angle = MATH_DEG_TO_RAD((float)rotateNode->getValue().get(3)); // COLLADA uses degrees, gameplay uses radians
-                if (x == 1.0f && y == 0.0f && z == 0.0f)
-                {
-                    dstTransform.rotateX(angle);
-                }
-                else if (x == 0.0f && y == 1.0f && z == 0.0f)
-                {
-                    dstTransform.rotateY(angle);
-                }
-                else if (x == 0.0f && y == 0.0f && z == 1.0f)
-                {
-                    dstTransform.rotateZ(angle);
-                }
-                else
-                {
-                    dstTransform.rotate(x, y, z, angle);
-                }
-                break;
+                dstTransform.rotateY(angle);
             }
-            case COLLADA_TYPE::SCALE:
+            else if (x == 0.0f && y == 0.0f && z == 1.0f)
             {
-                domScaleRef scaleNode = daeSafeCast<domScale>(childElement);
-                float x = (float)scaleNode->getValue().get(0);
-                float y = (float)scaleNode->getValue().get(1);
-                float z = (float)scaleNode->getValue().get(2);
-                dstTransform.scale(x, y, z);
-                break;
+                dstTransform.rotateZ(angle);
             }
-            case COLLADA_TYPE::SKEW:
-                LOG(1, "Warning: Skew transform found but not supported.\n");
-                break;
-            case COLLADA_TYPE::LOOKAT:
-                LOG(1, "Warning: Lookat transform found but not supported.\n");
-                break;
-            default:
-                break;
+            else
+            {
+                dstTransform.rotate(x, y, z, angle);
+            }
+        }
+        if (typeID == domScale::ID())
+        {
+            domScaleRef scaleNode = daeSafeCast<domScale>(childElement);
+            float x = (float)scaleNode->getValue().get(0);
+            float y = (float)scaleNode->getValue().get(1);
+            float z = (float)scaleNode->getValue().get(2);
+            dstTransform.scale(x, y, z);
+        }
+        if (typeID == domSkew::ID())
+        {
+            LOG(1, "Warning: Skew transform found but not supported.\n");
+        }
+        if (typeID == domLookat::ID())
+        {
+            LOG(1, "Warning: Lookat transform found but not supported.\n");
         }
     }
 }
@@ -1286,7 +1281,7 @@ void DAESceneEncoder::loadSkeleton(domNode* rootNode, MeshSkin* skin)
         domNode* topLevelParent = rootNode;
         while (
             topLevelParent->getParent() &&
-            topLevelParent->getParent()->typeID() == COLLADA_TYPE::NODE &&
+            topLevelParent->getParent()->typeID() == domNode::ID() &&
             _gamePlayFile.getFromRefTable(topLevelParent->getParent()->getID()) == NULL)
         {
             topLevelParent = (domNode*)topLevelParent->getParent();
@@ -1295,7 +1290,7 @@ void DAESceneEncoder::loadSkeleton(domNode* rootNode, MeshSkin* skin)
         // Is the parent of this node loaded yet?
         Node* parentNode = NULL;
         if (topLevelParent->getParent() &&
-            topLevelParent->getParent()->typeID() == COLLADA_TYPE::NODE &&
+            topLevelParent->getParent()->typeID() == domNode::ID() &&
             _gamePlayFile.getFromRefTable(topLevelParent->getParent()->getID()) != NULL)
         {
             parentNode = (Node*)_gamePlayFile.getFromRefTable(topLevelParent->getParent()->getID());
@@ -1372,7 +1367,7 @@ Model* DAESceneEncoder::loadSkin(const domSkin* skinElement)
             {
                 daeSIDResolver resolver(source->getDocument()->getDomRoot(), i->c_str());
                 daeElement* element = resolver.getElement();
-                if (element && element->typeID() == COLLADA_TYPE::NODE)
+                if (element && element->typeID() == domNode::ID())
                 {
                     domNodeRef node = daeSafeCast<domNode>(element);
                     const char* nodeId = node->getId();

+ 16 - 16
gameplay-encoder/src/DAEUtil.cpp

@@ -54,7 +54,7 @@ void getAnimationChannels(const domNodeRef& node, std::list<domChannelRef>& chan
     for (size_t i = 0; i < childCount; ++i)
     {
         daeElementRef childElement = children[i];
-        if (childElement->typeID() == COLLADA_TYPE::NODE)
+        if (childElement->typeID() == domNode::ID())
         {
             domNodeRef childNode = daeSafeCast<domNode>(childElement);
             getAnimationChannels(childNode, channels);
@@ -115,7 +115,7 @@ void getJointNames(const domSkin* skin, std::vector<std::string>& list)
 domSource* getInputSource(const domChannelRef& channel)
 {
     daeElement* element = channel->getSource().getElement();
-    if (element && element->typeID() == COLLADA_TYPE::SAMPLER)
+    if (element && element->typeID() == domSampler::ID())
     {
         domSampler* sampler = daeSafeCast<domSampler>(element);
         const domInputLocal_Array& inputArray = sampler->getInput_array();
@@ -126,7 +126,7 @@ domSource* getInputSource(const domChannelRef& channel)
             if (strcmp(input->getSemantic(), "INPUT") == 0)
             {
                 daeElement* e = input->getSource().getElement();
-                if (e && e->typeID() == COLLADA_TYPE::SOURCE)
+                if (e && e->typeID() == domSource::ID())
                 {
                     domSource* source = daeSafeCast<domSource>(e);
                     assert(source);
@@ -142,7 +142,7 @@ const domSamplerRef getSampler(const domChannelRef& channel)
 {
     const domURIFragmentType& uri = channel->getSource();
     daeElementRef element = uri.getElement();
-    if (element && element->typeID() == COLLADA_TYPE::SAMPLER)
+    if (element && element->typeID() == domSampler::ID())
     {
         const domSamplerRef sampler = daeSafeCast<domSampler>(element);
         return sampler;
@@ -150,7 +150,7 @@ const domSamplerRef getSampler(const domChannelRef& channel)
     // resolve the source manually by searching for the sampler in the animation that the channel is a child of.
     const std::string& id = uri.id();
     const daeElementRef& parent = channel->getParent();
-    if (parent && parent->typeID() == COLLADA_TYPE::ANIMATION)
+    if (parent && parent->typeID() == domAnimation::ID())
     {
         const domAnimationRef animation = daeSafeCast<domAnimation>(parent);
         
@@ -172,7 +172,7 @@ const domSourceRef getSource(const domInputLocalRef& inputLocal, const domAnimat
 {
     const domURIFragmentType& uri = inputLocal->getSource();
     daeElementRef element = uri.getElement();
-    if (element && element->typeID() == COLLADA_TYPE::SAMPLER)
+    if (element && element->typeID() == domSampler::ID())
     {
         const domSourceRef source = daeSafeCast<domSource>(element);
         return source;
@@ -205,7 +205,7 @@ const domName_arrayRef getSourceNameArray(const domSourceRef& source)
     for (size_t i = 0; i < childCount; ++i)
     {
         const daeElementRef element = children.get(i);
-        if (element->typeID() == COLLADA_TYPE::NAME_ARRAY)
+        if (element->typeID() == domName_array::ID())
         {
             return daeSafeCast<domName_array>(element);
         }
@@ -229,7 +229,7 @@ const domInstance_controller::domSkeletonRef getSkeleton(const domInstance_contr
     // Find the skeleton element that points to the root most node.
     const domInstance_controller::domSkeletonRef& currentSkeleton = skeletonArray.get(0);
     const daeElementRef element = currentSkeleton->getValue().getElement();
-    if (element && element->typeID() == COLLADA_TYPE::NODE)
+    if (element && element->typeID() == domNode::ID())
     {
         domNode* node = daeSafeCast<domNode>(element);
         int index = 0;
@@ -237,7 +237,7 @@ const domInstance_controller::domSkeletonRef getSkeleton(const domInstance_contr
         do
         {
             daeElementRef parent = node->getParent();
-            if (parent && parent->typeID() == COLLADA_TYPE::NODE)
+            if (parent && parent->typeID() == domNode::ID())
             {
                 domNodeRef parentNode = daeSafeCast<domNode>(parent);
                 int result = getIndex(skeletonArray, parentNode);
@@ -266,7 +266,7 @@ domNode* getRootJointNode(const domSkin* skin)
     getJointNames(skin, names);
     daeSIDResolver resolver(const_cast<domSkin*>(skin)->getDocument()->getDomRoot(), names[0].c_str());
     daeElement* element = resolver.getElement();
-    if (element && element->typeID() == COLLADA_TYPE::NODE)
+    if (element && element->typeID() == domNode::ID())
     {
         domNode* node = daeSafeCast<domNode>(resolver.getElement());
         return node;
@@ -326,7 +326,7 @@ void moveChannelAndSouresToAnimation(domChannelRef& channel, domAnimationRef& an
             inputArray = sampler->getInput_array();
             const domInputLocalRef& input = inputArray.get(i);
             daeElementRef element = input->getSource().getElement();
-            if (element && element->typeID() == COLLADA_TYPE::SOURCE)
+            if (element && element->typeID() == domSource::ID())
             {
                 domSourceRef source = daeSafeCast<domSource>(element);
                 assert(source);
@@ -355,7 +355,7 @@ int getIndex(const domInstance_controller::domSkeleton_Array& skeletonArray, con
     {
         const domInstance_controller::domSkeletonRef& skeleton = skeletonArray.get(i);
         daeElementRef element = skeleton->getValue().getElement();
-        if (element->typeID() == COLLADA_TYPE::NODE)
+        if (element->typeID() == domNode::ID())
         {
             domNodeRef targetNode = daeSafeCast<domNode>(element);
             if (nodeId.compare(targetNode->getId()) == 0)
@@ -395,7 +395,7 @@ void getAnimationChannels(const domAnimationRef& animationRef, const std::string
 domVisual_scene* getVisualScene(const domCOLLADA::domSceneRef& domScene)
 {
     daeElement* scene = domScene->getInstance_visual_scene()->getUrl().getElement();
-    if (scene->typeID() == COLLADA_TYPE::VISUAL_SCENE)
+    if (scene->typeID() == domVisual_scene::ID())
     {
         return static_cast<domVisual_scene*>(scene);
     }
@@ -425,7 +425,7 @@ domVisual_scene* getVisualScene(const domCOLLADA::domSceneRef& domScene)
 domNode* getParent(domNodeRef node)
 {
     daeElement* parent = node->getParent();
-    if (parent && parent->typeID() == COLLADA_TYPE::NODE)
+    if (parent && parent->typeID() == domNode::ID())
     {
         domNodeRef parentNode = daeSafeCast<domNode>(parent);
         return parentNode.cast();
@@ -436,7 +436,7 @@ domNode* getParent(domNodeRef node)
 domAnimation* getAnimation(domChannelRef channel)
 {
     daeElement* parent = channel->getParent();
-    if (parent && parent->typeID() == COLLADA_TYPE::ANIMATION)
+    if (parent && parent->typeID() == domAnimation::ID())
     {
         domAnimationRef parentNode = daeSafeCast<domAnimation>(parent);
         return parentNode.cast();
@@ -542,7 +542,7 @@ void findChannelsTargetingJoints(const domSourceRef& source, std::list<domChanne
     {
         daeSIDResolver resolver(source->getDocument()->getDomRoot(), i->c_str());
         daeElement* element = resolver.getElement();
-        if (element && element->typeID() == COLLADA_TYPE::NODE)
+        if (element && element->typeID() == domNode::ID())
         {
             domNodeRef node = daeSafeCast<domNode>(element);
             nodes.push_back(node);

+ 10 - 17
gameplay-encoder/src/FBXSceneEncoder.cpp

@@ -309,8 +309,8 @@ void FBXSceneEncoder::loadScene(FbxScene* fbxScene)
 void FBXSceneEncoder::loadAnimationChannels(FbxAnimLayer* animLayer, FbxNode* fbxNode, Animation* animation)
 {
     const char* name = fbxNode->GetName();
-    Node* node = _gamePlayFile.getNode(name);
-    
+    //Node* node = _gamePlayFile.getNode(name);
+
     // Determine which properties are animated on this node
     // Find the transform at each key frame
     // TODO: Ignore properties that are not animated (scale, rotation, translation)
@@ -466,6 +466,7 @@ void FBXSceneEncoder::loadAnimationChannels(FbxAnimLayer* animLayer, FbxNode* fb
     assert(channelCount > 0);
 
     // Allocate channel list
+    int channelStart = animation->getAnimationChannelCount();
     for (unsigned int i = 0; i < channelCount; ++i)
     {
         AnimationChannel* channel = new AnimationChannel();
@@ -499,7 +500,7 @@ void FBXSceneEncoder::loadAnimationChannels(FbxAnimLayer* animLayer, FbxNode* fb
         rotation.normalize();
 
         // Append keyframe data to all channels
-        for (unsigned int i = 0; i < channelCount; ++i)
+        for (unsigned int i = channelStart, channelEnd = channelStart + channelCount; i < channelEnd; ++i)
         {
             appendKeyFrame(fbxNode, animation->getAnimationChannel(i), time, scale, rotation, translation);
         }
@@ -517,18 +518,14 @@ void FBXSceneEncoder::loadAnimationLayer(FbxAnimLayer* fbxAnimLayer, FbxNode* fb
     bool animationGroupId = false;
     const char* name = fbxNode->GetName();
     // Check if this node's animations are supposed to be grouped
-    if (name)
+    if (name && arguments.containsGroupNodeId(name))
     {
-        std::string str = name;
-        if (arguments.containsGroupNodeId(str))
-        {
-            animationGroupId = true;
-            _groupAnimation = new Animation();
-            _groupAnimation->setId(arguments.getAnimationId(str));
-        }
+        animationGroupId = true;
+        _groupAnimation = new Animation();
+        _groupAnimation->setId(arguments.getAnimationId(name));
     }
     Animation* animation = _groupAnimation;
-    if (!_groupAnimation)
+    if (!animation)
     {
         animation = new Animation();
         animation->setId(name);
@@ -857,8 +854,7 @@ void FBXSceneEncoder::loadSkin(FbxMesh* fbxMesh, Model* model)
                 FbxCluster* cluster = fbxSkin->GetCluster(j);
                 assert(cluster);
                 FbxNode* linkedNode = cluster->GetLink();
-                assert(linkedNode);
-                if (linkedNode->GetSkeleton())
+                if (linkedNode && linkedNode->GetSkeleton())
                 {
                     const char* jointName = linkedNode->GetName();
                     assert(jointName);
@@ -1398,9 +1394,6 @@ bool loadBlendWeights(FbxMesh* fbxMesh, std::vector<std::vector<Vector2> >& weig
             {
                 FbxCluster* cluster = fbxSkin->GetCluster(j);
                 assert(cluster);
-                FbxNode* linkedNode = cluster->GetLink();
-                assert(linkedNode);
-
                 const int vertexIndexCount = cluster->GetControlPointIndicesCount();
                 for (int k = 0; k < vertexIndexCount; ++k)
                 {

+ 52 - 0
gameplay-luagen/CMakeLists.txt

@@ -0,0 +1,52 @@
+
+include_directories( 
+    ${CMAKE_SOURCE_DIR}/external-deps/lua/include
+    ${CMAKE_SOURCE_DIR}/external-deps/tinyxml2/include
+    /usr/include
+)
+
+add_definitions(-D__linux__)
+
+link_directories(
+    ${CMAKE_SOURCE_DIR}/external-deps/lua/lib/linux/${ARCH_DIR}
+    ${CMAKE_SOURCE_DIR}/external-deps/tinyxml2/lib/linux
+    /usr/lib
+)
+
+set(APP_LIBRARIES
+    lua
+    tinyxml2
+) 
+
+add_definitions(-lstdc++ -llua -ltinyxml2)
+
+set( APP_NAME gameplay-luagen )
+
+set(APP_SRC
+	src/Base.h
+	src/ClassBinding.cpp
+	src/ClassBinding.h
+	src/DebugNew.cpp
+	src/DebugNew.h
+	src/EnumBinding.h
+	src/FunctionBinding.cpp
+	src/FunctionBinding.h
+	src/Generator.cpp
+	src/Generator.h
+    src/main.cpp
+    src/TypedefBinding.h
+)
+
+add_executable(${APP_NAME}
+    ${APP_SRC}
+)
+
+target_link_libraries(${APP_NAME} ${APP_LIBRARIES})
+
+set_target_properties(${APP_NAME} PROPERTIES
+    OUTPUT_NAME "${APP_NAME}"
+    CLEAN_DIRECT_OUTPUT 1
+)
+
+source_group(src FILES ${APP_SRC})
+

+ 75 - 36
gameplay-luagen/src/FunctionBinding.cpp

@@ -7,9 +7,9 @@ static inline void outputLuaTypeCheckInstance(ostream& o);
 static inline void outputLuaTypeCheck(ostream& o, int index, const FunctionBinding::Param& p = 
     FunctionBinding::Param(FunctionBinding::Param::TYPE_OBJECT, FunctionBinding::Param::KIND_POINTER));
 static inline void indent(ostream& o, int indentLevel);
-static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel);
-static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, int i, int indentLevel, bool offsetIndex = false);
-static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel);
+static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel, int numBindings);
+static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, int i, int indentLevel, bool offsetIndex, int numBindings);
+static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel, int numBindings);
 static inline void outputReturnValue(ostream& o, const FunctionBinding& b, int indentLevel);
 static inline std::string getTypeName(const FunctionBinding::Param& param);
 
@@ -76,6 +76,11 @@ void FunctionBinding::write(ostream& o, const vector<FunctionBinding>& bindings)
 {
     GP_ASSERT(bindings.size() > 0);
 
+    if (bindings[0].getFunctionName() == "lua_AudioListener_static_getInstance")
+    {
+        int i = 0;
+    }
+
     // Print the function signature.
     o << "int " << bindings[0].getFunctionName() << "(lua_State* state)\n";
     o << "{\n";
@@ -94,7 +99,7 @@ void FunctionBinding::write(ostream& o, const vector<FunctionBinding>& bindings)
         o << "    " << bindings[0].classname << "* instance = getInstance(state);\n";
         o << "    if (lua_gettop(state) == 2)\n";
         o << "    {\n";
-        outputGetParam(o, bindings[0].returnParam, 1, 2);
+        outputGetParam(o, bindings[0].returnParam, 1, 2, false, 1);
 
         if (bindings[0].returnParam.kind == FunctionBinding::Param::KIND_POINTER &&
             bindings[0].returnParam.type != FunctionBinding::Param::TYPE_OBJECT &&
@@ -161,7 +166,7 @@ void FunctionBinding::write(ostream& o, const vector<FunctionBinding>& bindings)
         // Get or set the static variable depending on the number of parameters.
         o << "    if (lua_gettop(state) == 1)\n";
         o << "    {\n";
-        outputGetParam(o, bindings[0].returnParam, 0, 2);
+        outputGetParam(o, bindings[0].returnParam, 0, 2, false, 1);
 
         if (bindings[0].returnParam.kind == FunctionBinding::Param::KIND_POINTER &&
             bindings[0].returnParam.type != FunctionBinding::Param::TYPE_OBJECT &&
@@ -359,27 +364,17 @@ void FunctionBinding::write(ostream& o, const vector<FunctionBinding>& bindings)
                 if (iter->first > 0)
                     indent(o, 3);
 
-                if (i > 0)
-                {                    
-                    o << "else ";
-                }
-                outputMatchedBinding(o, *(iter->second[i]), iter->first, 3);
+                outputMatchedBinding(o, *(iter->second[i]), iter->first, 3, bindings.size());
             }
 
             // Only print an else clause with error report if there are parameters.
             if (iter->first > 0)
             {
                 indent(o, 3);
-                o << "else\n";
-                indent(o, 3);
-                o << "{\n";
-                indent(o, 4);
                 o << "lua_pushstring(state, \"" << bindings[0].getFunctionName();
                 o << " - Failed to match the given parameters to a valid function signature.\");\n";
-                indent(o, 4);
-                o << "lua_error(state);\n";
                 indent(o, 3);
-                o << "}\n";
+                o << "lua_error(state);\n";
             }
             
             o << "            break;\n";
@@ -575,14 +570,14 @@ static inline void indent(ostream& o, int indentLevel)
         o << "    ";
 }
 
-static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel)
+static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel, int numBindings)
 {
-    bool isNormalMember = (b.type == FunctionBinding::MEMBER_FUNCTION && b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR);
+    bool isNonStatic = (b.type == FunctionBinding::MEMBER_FUNCTION && b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR);
 
     // Get the passed in parameters.
-    for (unsigned int i = 0, count = paramCount - (isNormalMember ? 1 : 0); i < count; i++)
+    for (unsigned int i = 0, count = paramCount - (isNonStatic ? 1 : 0); i < count; i++)
     {
-        outputGetParam(o, b.paramTypes[i], i, indentLevel, isNormalMember);
+        outputGetParam(o, b.paramTypes[i], i, indentLevel, isNonStatic, numBindings);
     }
 
     // Get the instance for member functions.
@@ -680,7 +675,7 @@ static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b,
         }
 
         // Pass the arguments.
-        for (unsigned int i = 0, count = paramCount - ((isNormalMember) ? 1 : 0); i < count; i++)
+        for (unsigned int i = 0, count = paramCount - ((isNonStatic) ? 1 : 0); i < count; i++)
         {
             if (b.paramTypes[i].type == FunctionBinding::Param::TYPE_OBJECT && b.paramTypes[i].kind != FunctionBinding::Param::KIND_POINTER)
                 o << "*";
@@ -700,7 +695,7 @@ static inline void outputBindingInvocation(ostream& o, const FunctionBinding& b,
     outputReturnValue(o, b, indentLevel);
 }
 
-static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, int i, int indentLevel, bool offsetIndex)
+static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, int i, int indentLevel, bool offsetIndex, int numBindings)
 {
     indent(o, indentLevel);
     o << "// Get parameter " << i + 1 << " off the stack.\n";
@@ -812,13 +807,35 @@ static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, i
         o << "(" << p.info << ")luaL_checkunsigned(state, " << paramIndex << ");\n";
         break;
     case FunctionBinding::Param::TYPE_OBJECT:
-        indent(o, indentLevel);
-        o << "ScriptUtil::LuaArray<" << getTypeName(p) << ">";
-        o << " param" << i + 1 << " = ";
-        o << "ScriptUtil::getObjectPointer<";
-        o << Generator::getInstance()->getIdentifier(p.info) << ">(" << paramIndex;
-        o << ", \"" << Generator::getInstance()->getUniqueNameFromRef(p.info) << "\", ";
-        o << ((p.kind != FunctionBinding::Param::KIND_POINTER) ? "true" : "false") << ");\n";
+        {
+            indent(o, indentLevel);
+            o << "bool param" << i + 1 << "Valid;\n";
+            indent(o, indentLevel);
+            o << "ScriptUtil::LuaArray<" << getTypeName(p) << ">";
+            o << " param" << i + 1 << " = ";
+            o << "ScriptUtil::getObjectPointer<";
+            o << Generator::getInstance()->getIdentifier(p.info) << ">(" << paramIndex;
+            o << ", \"" << Generator::getInstance()->getUniqueNameFromRef(p.info) << "\", ";
+            o << ((p.kind != FunctionBinding::Param::KIND_POINTER) ? "true" : "false") << ", &param" << i + 1 << "Valid);\n";
+            indent(o, indentLevel);
+            o << "if (!param" << i + 1 << "Valid)\n";
+            if (numBindings > 1)
+            {
+                indent(o, indentLevel + 1);
+                o << "break;\n";
+            }
+            else
+            {
+                indent(o, indentLevel);
+                o << "{\n";
+                indent(o, indentLevel + 1);
+                o << "lua_pushstring(state, \"Failed to convert parameter " << i + 1 << " to type '" << getTypeName(p) << "'.\");\n";
+                indent(o, indentLevel + 1);
+                o << "lua_error(state);\n";
+                indent(o, indentLevel);
+                o << "}\n";
+            }
+        }
         break;
     case FunctionBinding::Param::TYPE_CONSTRUCTOR:
     case FunctionBinding::Param::TYPE_DESTRUCTOR:
@@ -831,14 +848,14 @@ static inline void outputGetParam(ostream& o, const FunctionBinding::Param& p, i
     o << "\n";
 }
 
-static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel)
+static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, unsigned int paramCount, unsigned int indentLevel, int numBindings)
 {
-    bool isNormalMember = (b.type == FunctionBinding::MEMBER_FUNCTION && b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR);
+    bool isNonStatic = (b.type == FunctionBinding::MEMBER_FUNCTION && b.returnParam.type != FunctionBinding::Param::TYPE_CONSTRUCTOR);
 
     // If the current invocation of the function takes zero parameters, then invoke the binding.
     if (paramCount == 0)
     {
-        outputBindingInvocation(o, b, paramCount, indentLevel);
+        outputBindingInvocation(o, b, paramCount, indentLevel, numBindings);
     }
     else
     {
@@ -848,13 +865,27 @@ static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, un
         // when the user in fact wanted to call the version with more precision.
         // (this will only happen for overloaded functions).
 
+        if (numBindings > 1)
+        {
+            o << "do\n";
+            indent(o, indentLevel);
+            o << "{\n";
+            indent(o, ++indentLevel);
+        }
+
         o << "if (";
         for (unsigned int i = 0, count = paramCount; i < count; i++)
         {
-            if (isNormalMember && i == 0)
+            if (isNonStatic && i == 0)
+            {
+                // This is always the "this / self" pointer for a member function
                 outputLuaTypeCheckInstance(o);
+            }
             else
-                outputLuaTypeCheck(o, i + 1, b.paramTypes[(isNormalMember ? i - 1 : i)]);
+            {
+                // Function parameter
+                outputLuaTypeCheck(o, i + 1, b.paramTypes[(isNonStatic ? i - 1 : i)]);
+            }
 
             if (i == count - 1)
                 o << ")\n";
@@ -867,10 +898,18 @@ static inline void outputMatchedBinding(ostream& o, const FunctionBinding& b, un
         indent(o, indentLevel);
         o << "{\n";
             
-        outputBindingInvocation(o, b, paramCount, indentLevel + 1);
+        outputBindingInvocation(o, b, paramCount, indentLevel + 1, numBindings);
 
         indent(o, indentLevel);
         o << "}\n";
+
+        if (numBindings > 1)
+        {
+            indent(o, --indentLevel);
+            o << "} while (0);\n";
+        }
+
+        o << "\n";
     }
 }
 

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

@@ -37,6 +37,9 @@ int main(int argc, char** argv)
     Generator::releaseInstance();
     SAFE_DELETE(bindingNS);
 
+#ifdef WIN32
     system("pause");
+#endif
+    
     return 0;
 }

+ 8 - 2
gameplay-template/gameplay-template-CMakeLists.txt

@@ -3,6 +3,12 @@ PROJECT(TEMPLATE_PROJECT)
 
 set(GAME_NAME TEMPLATE_PROJECT)
 
+if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
+    set(ARCH_DIR "x64" )
+else( CMAKE_SIZEOF_VOID_P EQUAL 8 )
+    set(ARCH_DIR "x86" )
+endif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
+
 set(GAMEPLAY_SRC_PATH "GAMEPLAY_PATH") 
 set(GAMEPLAY_EXT_LIBS_PATH "${GAMEPLAY_SRC_PATH}/external-deps")
 
@@ -23,7 +29,7 @@ macro (append_gameplay_ext_lib listToAppend libName libDirName)
         find_library(FOUND_LIB_${libName} ${libName})
     ELSE("${libDirName}" STREQUAL "")
         set(pathToSearch
-            "${GAMEPLAY_EXT_LIBS_PATH}/${libDirName}/lib/${TARGET_OS_DIR}")
+            "${GAMEPLAY_EXT_LIBS_PATH}/${libDirName}/lib/${TARGET_OS_DIR}/${ARCH_DIR}")
         find_library(FOUND_LIB_${libName} ${libName} HINTS ${pathToSearch})
     ENDIF("${libDirName}" STREQUAL "")
 
@@ -32,7 +38,7 @@ macro (append_gameplay_ext_lib listToAppend libName libDirName)
 endmacro (append_gameplay_ext_lib)
 
 macro(copy_files TARGET_NAME GLOBPAT SOURCE DESTINATION)
-  file(GLOB COPY_FILES
+  file(GLOB_RECURSE COPY_FILES
     RELATIVE ${SOURCE}
     "${SOURCE}/${GLOBPAT}")
   add_custom_target(${TARGET_NAME} ALL

+ 153 - 5
gameplay-template/gameplay-template.vcxproj

@@ -5,14 +5,26 @@
       <Configuration>DebugMem</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="DebugMem|x64">
+      <Configuration>DebugMem</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Debug|Win32">
       <Configuration>Debug</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Win32">
       <Configuration>Release</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   <PropertyGroup Label="Globals">
     <Keyword>Win32Proj</Keyword>
@@ -24,29 +36,54 @@
     <UseDebugLibraries>true</UseDebugLibraries>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <LinkIncremental>true</LinkIncremental>
@@ -55,18 +92,35 @@
     <CustomBuildBeforeTargets>
     </CustomBuildBeforeTargets>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <OutDir>$(Configuration)\</OutDir>
+    <ExecutablePath>$(ExecutablePath)</ExecutablePath>
+    <CustomBuildBeforeTargets />
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|Win32'">
     <LinkIncremental>true</LinkIncremental>
     <OutDir>$(Configuration)\</OutDir>
     <ExecutablePath>$(ExecutablePath)</ExecutablePath>
     <CustomBuildBeforeTargets />
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|x64'">
+    <LinkIncremental>true</LinkIncremental>
+    <OutDir>$(Configuration)\</OutDir>
+    <ExecutablePath>$(ExecutablePath)</ExecutablePath>
+    <CustomBuildBeforeTargets />
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <LinkIncremental>false</LinkIncremental>
     <OutDir>$(Configuration)\</OutDir>
     <CustomBuildBeforeTargets>
     </CustomBuildBeforeTargets>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+    <OutDir>$(Configuration)\</OutDir>
+    <CustomBuildBeforeTargets />
+  </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <PrecompiledHeader>
@@ -82,7 +136,37 @@
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/lua/lib/windows;GAMEPLAY_PATH/external-deps/bullet/lib/windows;GAMEPLAY_PATH/external-deps/openal/lib/windows;GAMEPLAY_PATH/external-deps/oggvorbis/lib/windows;GAMEPLAY_PATH/external-deps/glew/lib/windows;GAMEPLAY_PATH/external-deps/libpng/lib/windows;GAMEPLAY_PATH/external-deps/zlib/lib/windows;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/lua/lib/windows/x86;GAMEPLAY_PATH/external-deps/bullet/lib/windows/x86;GAMEPLAY_PATH/external-deps/openal/lib/windows/x86;GAMEPLAY_PATH/external-deps/oggvorbis/lib/windows/x86;GAMEPLAY_PATH/external-deps/glew/lib/windows/x86;GAMEPLAY_PATH/external-deps/libpng/lib/windows/x86;GAMEPLAY_PATH/external-deps/zlib/lib/windows/x86;GAMEPLAY_PATH/gameplay/windows/x86/$(Configuration)</AdditionalLibraryDirectories>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
+    <CustomBuildStep>
+      <Command>
+      </Command>
+      <Message>
+      </Message>
+      <Outputs>
+      </Outputs>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/lua/include;GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
+      <RuntimeTypeInfo>true</RuntimeTypeInfo>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/lua/lib/windows/x64;GAMEPLAY_PATH/external-deps/bullet/lib/windows/x64;GAMEPLAY_PATH/external-deps/openal/lib/windows/x64;GAMEPLAY_PATH/external-deps/oggvorbis/lib/windows/x64;GAMEPLAY_PATH/external-deps/glew/lib/windows/x64;GAMEPLAY_PATH/external-deps/libpng/lib/windows/x64;GAMEPLAY_PATH/external-deps/zlib/lib/windows/x64;GAMEPLAY_PATH/gameplay/windows/x64/$(Configuration)</AdditionalLibraryDirectories>
     </Link>
     <PostBuildEvent>
       <Command>
@@ -129,6 +213,38 @@
       </Outputs>
     </CustomBuildStep>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|x64'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;GAMEPLAY_MEM_LEAK_DETECTION;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/lua/include;GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
+      <RuntimeTypeInfo>true</RuntimeTypeInfo>
+      <ShowIncludes>false</ShowIncludes>
+      <PreprocessToFile>false</PreprocessToFile>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/lua/lib/windows;GAMEPLAY_PATH/external-deps/bullet/lib/windows;GAMEPLAY_PATH/external-deps/openal/lib/windows;GAMEPLAY_PATH/external-deps/oggvorbis/lib/windows;GAMEPLAY_PATH/external-deps/glew/lib/windows;GAMEPLAY_PATH/external-deps/libpng/lib/windows;GAMEPLAY_PATH/external-deps/zlib/lib/windows;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
+    <CustomBuildStep>
+      <Command>
+      </Command>
+      <Message>
+      </Message>
+      <Outputs>
+      </Outputs>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
@@ -161,18 +277,50 @@
       </Outputs>
     </CustomBuildStep>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>GAMEPLAY_PATH/external-deps/lua/include;GAMEPLAY_PATH/external-deps/bullet/include;GAMEPLAY_PATH/gameplay/src;GAMEPLAY_PATH/external-deps/openal/include/AL;GAMEPLAY_PATH/external-deps/oggvorbis/include;GAMEPLAY_PATH/external-deps/libpng/include;GAMEPLAY_PATH/external-deps/zlib/include;GAMEPLAY_PATH/external-deps/glew/include</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalDependencies>lua.lib;OpenAL32.lib;OpenGL32.lib;GLU32.lib;glew32.lib;libpng14.lib;zlib.lib;gameplay.lib;BulletDynamics.lib;BulletCollision.lib;LinearMath.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>GAMEPLAY_PATH/external-deps/lua/lib/windows;GAMEPLAY_PATH/external-deps/bullet/lib/windows;GAMEPLAY_PATH/external-deps/openal/lib/windows;GAMEPLAY_PATH/external-deps/oggvorbis/lib/windows;GAMEPLAY_PATH/external-deps/glew/lib/windows;GAMEPLAY_PATH/external-deps/libpng/lib/windows;GAMEPLAY_PATH/external-deps/zlib/lib/windows;GAMEPLAY_PATH/gameplay/$(Configuration)</AdditionalLibraryDirectories>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+      </Command>
+    </PostBuildEvent>
+    <CustomBuildStep>
+      <Command>
+      </Command>
+      <Message>
+      </Message>
+      <Outputs>
+      </Outputs>
+    </CustomBuildStep>
+  </ItemDefinitionGroup>
   <ItemGroup>
-    <None Include="bar-descriptor.xml" >
-        <SubType>Designer</SubType>
+    <None Include="bar-descriptor.xml">
+      <SubType>Designer</SubType>
     </None>
     <None Include="game.config" />
-	<None Include="icon.png" />
+    <None Include="icon.png" />
     <None Include="res\box.dae" />
     <None Include="res\box.gpb" />
     <None Include="res\box.material" />
     <None Include="res\colored.frag" />
     <None Include="res\colored.vert" />
-  </ItemGroup> 
+  </ItemGroup>
   <ItemGroup>
     <ClCompile Include="src\TemplateGame.cpp" />
   </ItemGroup>

+ 15 - 3
gameplay-template/gameplay-template.vcxproj.user

@@ -1,15 +1,27 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/bin/windows;</LocalDebuggerEnvironment>
+    <LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/bin/windows/x86;</LocalDebuggerEnvironment>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/bin/windows/x64;</LocalDebuggerEnvironment>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-	<LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/bin/windows;</LocalDebuggerEnvironment>
+    <LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/bin/windows;</LocalDebuggerEnvironment>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/bin/windows;</LocalDebuggerEnvironment>
     <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|Win32'">
     <LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/bin/windows;</LocalDebuggerEnvironment>
-	<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|x64'">
+    <LocalDebuggerEnvironment>PATH=%PATH%;GAMEPLAY_PATH/bin/windows;</LocalDebuggerEnvironment>
+    <DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
   </PropertyGroup>
 </Project>

+ 1 - 1
gameplay-template/res/box.material

@@ -10,7 +10,7 @@ material box
             
             // uniforms
             u_worldViewProjectionMatrix = WORLD_VIEW_PROJECTION_MATRIX
-            u_inverseTransposeWorldViewMatrix = INVERSE_TRANSPOSE_WORLD_VIEW_MATRIX
+            u_inverseTransposeWorldMatrix = INVERSE_TRANSPOSE_WORLD_MATRIX
             u_diffuseColor = 1.0, 1.0, 1.0, 1.0
 
             // render state

+ 2 - 2
gameplay-template/res/colored.vert

@@ -4,7 +4,7 @@ attribute vec3 a_normal;                            // Vertex Normal (x, y, z)
 
 // Uniforms
 uniform mat4 u_worldViewProjectionMatrix;           // Matrix to transform a position to clip space.
-uniform mat4 u_inverseTransposeWorldViewMatrix;     // Matrix to transform a normal to view space.
+uniform mat4 u_inverseTransposeWorldMatrix;         // Matrix to transform a normal to view space.
 
 // Outputs
 varying vec3 v_normalVector;                        // Normal vector in view space.
@@ -19,6 +19,6 @@ void main()
     gl_Position = u_worldViewProjectionMatrix * position;
 
     // Transform normal to view space.
-    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz, u_inverseTransposeWorldViewMatrix[1].xyz, u_inverseTransposeWorldViewMatrix[2].xyz);
+    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldMatrix[0].xyz, u_inverseTransposeWorldMatrix[1].xyz, u_inverseTransposeWorldMatrix[2].xyz);
     v_normalVector = inverseTransposeWorldViewMatrix * normal;
 }

+ 132 - 75
gameplay.sln

@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual Studio 2010
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay", "gameplay\gameplay.vcxproj", "{1032BA4B-57EB-4348-9E03-29DD63E80E4A}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay-tests", "gameplay-tests\gameplay-tests.vcxproj", "{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gameplay-tests", "gameplay-tests\gameplay-tests.vcxproj", "{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
 	EndProjectSection
@@ -33,12 +33,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample04-particles", "gamep
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample05-lua", "gameplay-samples\sample05-lua\sample05-lua.vcxproj", "{C6121A62-AA46-BA6D-A1CE-8000544456AA}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample05-lua", "gameplay-samples\sample05-lua\sample05-lua.vcxproj", "{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample06-racer", "gameplay-samples\sample06-racer\sample06-racer.vcxproj", "{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sample06-racer", "gameplay-samples\sample06-racer\sample06-racer.vcxproj", "{82522888-E09A-ED48-AD7D-247237B37B3A}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A} = {1032BA4B-57EB-4348-9E03-29DD63E80E4A}
 	EndProjectSection
@@ -48,12 +48,15 @@ Global
 		Debug|BlackBerry = Debug|BlackBerry
 		Debug|BlackBerrySimulator = Debug|BlackBerrySimulator
 		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
 		DebugMem|BlackBerry = DebugMem|BlackBerry
 		DebugMem|BlackBerrySimulator = DebugMem|BlackBerrySimulator
 		DebugMem|Win32 = DebugMem|Win32
+		DebugMem|x64 = DebugMem|x64
 		Release|BlackBerry = Release|BlackBerry
 		Release|BlackBerrySimulator = Release|BlackBerrySimulator
 		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
@@ -64,6 +67,8 @@ Global
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|Win32.ActiveCfg = Debug|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|Win32.Build.0 = Debug|Win32
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|x64.ActiveCfg = Debug|x64
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Debug|x64.Build.0 = Debug|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
@@ -72,6 +77,8 @@ Global
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|x64.ActiveCfg = DebugMem|x64
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.DebugMem|x64.Build.0 = DebugMem|x64
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerry.Build.0 = Release|BlackBerry
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
@@ -80,30 +87,38 @@ Global
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|Win32.ActiveCfg = Release|Win32
 		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|Win32.Build.0 = Release|Win32
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Debug|Win32.ActiveCfg = Debug|Win32
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Debug|Win32.Build.0 = Debug|Win32
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.DebugMem|Win32.Build.0 = DebugMem|Win32
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Release|Win32.ActiveCfg = Release|Win32
-		{D70B295E-A2FF-2CBB-737E-3876E8AF77F6}.Release|Win32.Build.0 = Release|Win32
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|x64.ActiveCfg = Release|x64
+		{1032BA4B-57EB-4348-9E03-29DD63E80E4A}.Release|x64.Build.0 = Release|x64
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|Win32.Build.0 = Debug|Win32
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|x64.ActiveCfg = Debug|x64
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Debug|x64.Build.0 = Debug|x64
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|x64.ActiveCfg = DebugMem|x64
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.DebugMem|x64.Build.0 = DebugMem|x64
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerry.Build.0 = Release|BlackBerry
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|Win32.ActiveCfg = Release|Win32
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|Win32.Build.0 = Release|Win32
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|x64.ActiveCfg = Release|x64
+		{0F27C8C4-58B2-E367-8D1F-01B714FDBF1B}.Release|x64.Build.0 = Release|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
@@ -112,6 +127,8 @@ Global
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.ActiveCfg = Debug|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|Win32.Build.0 = Debug|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|x64.ActiveCfg = Debug|x64
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Debug|x64.Build.0 = Debug|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
@@ -120,6 +137,8 @@ Global
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|x64.ActiveCfg = DebugMem|x64
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.DebugMem|x64.Build.0 = DebugMem|x64
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerry.Build.0 = Release|BlackBerry
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
@@ -128,6 +147,8 @@ Global
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.ActiveCfg = Release|Win32
 		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|Win32.Build.0 = Release|Win32
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|x64.ActiveCfg = Release|x64
+		{D672DC66-3CE0-4878-B0D2-813CA731012F}.Release|x64.Build.0 = Release|x64
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
@@ -136,6 +157,8 @@ Global
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|Win32.ActiveCfg = Debug|Win32
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|Win32.Build.0 = Debug|Win32
+		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|x64.ActiveCfg = Debug|x64
+		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Debug|x64.Build.0 = Debug|x64
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
@@ -144,6 +167,8 @@ Global
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|x64.ActiveCfg = DebugMem|x64
+		{9A515C8B-3320-4C5C-9754-211E91206C9D}.DebugMem|x64.Build.0 = DebugMem|x64
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|BlackBerry.Build.0 = Release|BlackBerry
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
@@ -152,6 +177,8 @@ Global
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|Win32.ActiveCfg = Release|Win32
 		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|Win32.Build.0 = Release|Win32
+		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|x64.ActiveCfg = Release|x64
+		{9A515C8B-3320-4C5C-9754-211E91206C9D}.Release|x64.Build.0 = Release|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
@@ -160,6 +187,8 @@ Global
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|Win32.Build.0 = Debug|Win32
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|x64.ActiveCfg = Debug|x64
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Debug|x64.Build.0 = Debug|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
@@ -168,6 +197,8 @@ Global
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|x64.ActiveCfg = DebugMem|x64
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.DebugMem|x64.Build.0 = DebugMem|x64
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerry.Build.0 = Release|BlackBerry
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
@@ -176,6 +207,8 @@ Global
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|Win32.ActiveCfg = Release|Win32
 		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|Win32.Build.0 = Release|Win32
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|x64.ActiveCfg = Release|x64
+		{CC37B8E9-6402-4841-8D6A-5D908A5909B3}.Release|x64.Build.0 = Release|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
@@ -184,6 +217,8 @@ Global
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|Win32.ActiveCfg = Debug|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|Win32.Build.0 = Debug|Win32
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|x64.ActiveCfg = Debug|x64
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Debug|x64.Build.0 = Debug|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
@@ -192,6 +227,8 @@ Global
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|x64.ActiveCfg = DebugMem|x64
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.DebugMem|x64.Build.0 = DebugMem|x64
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerry.Build.0 = Release|BlackBerry
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
@@ -200,6 +237,8 @@ Global
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|Win32.ActiveCfg = Release|Win32
 		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|Win32.Build.0 = Release|Win32
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|x64.ActiveCfg = Release|x64
+		{87388E8B-F3CF-428F-BC2C-C1886248C111}.Release|x64.Build.0 = Release|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
@@ -208,6 +247,8 @@ Global
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|Win32.Build.0 = Debug|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|x64.ActiveCfg = Debug|x64
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Debug|x64.Build.0 = Debug|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
@@ -216,6 +257,8 @@ Global
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|x64.ActiveCfg = DebugMem|x64
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.DebugMem|x64.Build.0 = DebugMem|x64
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerry.Build.0 = Release|BlackBerry
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
@@ -224,54 +267,68 @@ Global
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|Win32.ActiveCfg = Release|Win32
 		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|Win32.Build.0 = Release|Win32
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Debug|Win32.ActiveCfg = Debug|Win32
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Debug|Win32.Build.0 = Debug|Win32
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.DebugMem|Win32.Build.0 = DebugMem|Win32
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Release|Win32.ActiveCfg = Release|Win32
-		{C6121A62-AA46-BA6D-A1CE-8000544456AA}.Release|Win32.Build.0 = Release|Win32
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Debug|Win32.ActiveCfg = Debug|Win32
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Debug|Win32.Build.0 = Debug|Win32
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.DebugMem|Win32.Build.0 = DebugMem|Win32
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Release|BlackBerry.Build.0 = Release|BlackBerry
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Release|Win32.ActiveCfg = Release|Win32
-		{1808B3EA-1ED5-1219-6D3C-9F588D2D8385}.Release|Win32.Build.0 = Release|Win32
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|x64.ActiveCfg = Release|x64
+		{CB5ABFAA-EA69-E439-5A4D-3B9359916C71}.Release|x64.Build.0 = Release|x64
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|Win32.ActiveCfg = Debug|Win32
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|Win32.Build.0 = Debug|Win32
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|x64.ActiveCfg = Debug|x64
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Debug|x64.Build.0 = Debug|x64
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|x64.ActiveCfg = DebugMem|x64
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.DebugMem|x64.Build.0 = DebugMem|x64
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerry.Build.0 = Release|BlackBerry
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|Win32.ActiveCfg = Release|Win32
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|Win32.Build.0 = Release|Win32
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|x64.ActiveCfg = Release|x64
+		{04EAF3E5-0F9E-AF4D-53F9-269CE114211F}.Release|x64.Build.0 = Release|x64
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerry.ActiveCfg = Debug|BlackBerry
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerry.Build.0 = Debug|BlackBerry
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerry.Deploy.0 = Debug|BlackBerry
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerrySimulator.ActiveCfg = Debug|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerrySimulator.Build.0 = Debug|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|BlackBerrySimulator.Deploy.0 = Debug|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|Win32.ActiveCfg = Debug|Win32
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|Win32.Build.0 = Debug|Win32
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|x64.ActiveCfg = Debug|x64
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Debug|x64.Build.0 = Debug|x64
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerry.ActiveCfg = DebugMem|BlackBerry
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerry.Build.0 = DebugMem|BlackBerry
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerry.Deploy.0 = DebugMem|BlackBerry
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerrySimulator.ActiveCfg = DebugMem|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerrySimulator.Build.0 = DebugMem|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|BlackBerrySimulator.Deploy.0 = DebugMem|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|Win32.ActiveCfg = DebugMem|Win32
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|Win32.Build.0 = DebugMem|Win32
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|x64.ActiveCfg = DebugMem|x64
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.DebugMem|x64.Build.0 = DebugMem|x64
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerry.ActiveCfg = Release|BlackBerry
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerry.Build.0 = Release|BlackBerry
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerry.Deploy.0 = Release|BlackBerry
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerrySimulator.ActiveCfg = Release|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerrySimulator.Build.0 = Release|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|BlackBerrySimulator.Deploy.0 = Release|BlackBerrySimulator
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|Win32.ActiveCfg = Release|Win32
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|Win32.Build.0 = Release|Win32
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|x64.ActiveCfg = Release|x64
+		{82522888-E09A-ED48-AD7D-247237B37B3A}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 13 - 13
gameplay/CMakeLists.txt

@@ -77,7 +77,7 @@ set(GAMEPLAY_SRC
     src/gameplay-main-blackberry.cpp
     src/gameplay-main-linux.cpp
     src/gameplay-main-windows.cpp
-	src/Gesture.h
+    src/Gesture.h
     src/Image.cpp
     src/Image.h
     src/Image.inl
@@ -146,10 +146,10 @@ set(GAMEPLAY_SRC
     src/PhysicsSocketConstraint.h
     src/PhysicsSpringConstraint.cpp
     src/PhysicsSpringConstraint.h
-	src/PhysicsVehicle.cpp
-	src/PhysicsVehicle.h
-	src/PhysicsVehicleWheel.cpp
-	src/PhysicsVehicle.h
+    src/PhysicsVehicle.cpp
+    src/PhysicsVehicle.h
+    src/PhysicsVehicleWheel.cpp
+    src/PhysicsVehicle.h
     src/Plane.cpp
     src/Plane.h
     src/Plane.inl
@@ -333,10 +333,10 @@ set(GAMEPLAY_LUA
     src/lua/lua_GamepadGamepadEvent.h
     src/lua/lua_GameState.cpp
     src/lua/lua_GameState.h
-	src/lua/lua_Gesture.cpp
-	src/lua/lua_Gesture.h
-	src/lua/lua_GestureGestureEvent.cpp
-	src/lua/lua_GestureGestureEvent.h
+    src/lua/lua_Gesture.cpp
+    src/lua/lua_Gesture.h
+    src/lua/lua_GestureGestureEvent.cpp
+    src/lua/lua_GestureGestureEvent.h
     src/lua/lua_Global.cpp
     src/lua/lua_Global.h
     src/lua/lua_Image.cpp
@@ -451,10 +451,10 @@ set(GAMEPLAY_LUA
     src/lua/lua_PhysicsSocketConstraint.h
     src/lua/lua_PhysicsSpringConstraint.cpp
     src/lua/lua_PhysicsSpringConstraint.h
-	src/lua/lua_PhysicsVehicle.cpp
-	src/lua/lua_PhysicsVehicle.h
-	src/lua/lua_PhysicsVehicleWheel.cpp
-	src/lua/lua_PhysicsVehicleWheel.h
+    src/lua/lua_PhysicsVehicle.cpp
+    src/lua/lua_PhysicsVehicle.h
+    src/lua/lua_PhysicsVehicleWheel.cpp
+    src/lua/lua_PhysicsVehicleWheel.h
     src/lua/lua_Plane.cpp
     src/lua/lua_Plane.h
     src/lua/lua_Platform.cpp

+ 126 - 6
gameplay/gameplay.vcxproj

@@ -13,6 +13,10 @@
       <Configuration>DebugMem</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="DebugMem|x64">
+      <Configuration>DebugMem</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Debug|BlackBerry">
       <Configuration>Debug</Configuration>
       <Platform>BlackBerry</Platform>
@@ -25,6 +29,10 @@
       <Configuration>Debug</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|BlackBerry">
       <Configuration>Release</Configuration>
       <Platform>BlackBerry</Platform>
@@ -37,6 +45,10 @@
       <Configuration>Release</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="src\AbsoluteLayout.cpp" />
@@ -635,6 +647,11 @@
     <UseDebugLibraries>true</UseDebugLibraries>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|BlackBerry'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
@@ -650,6 +667,11 @@
     <UseDebugLibraries>true</UseDebugLibraries>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|BlackBerry'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
@@ -666,6 +688,12 @@
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|BlackBerry'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
@@ -684,6 +712,9 @@
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|BlackBerry'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
@@ -693,6 +724,9 @@
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|BlackBerry'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
@@ -702,6 +736,9 @@
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|BlackBerry'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
@@ -710,7 +747,10 @@
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(Configuration)\</OutDir>
+    <OutDir>windows\x86\$(Configuration)\</OutDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <OutDir>windows\x64\$(Configuration)\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|BlackBerry'">
     <OutDir>Device-$(Configuration)\</OutDir>
@@ -719,7 +759,10 @@
     <OutDir>Simulator\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|Win32'">
-    <OutDir>$(Configuration)\</OutDir>
+    <OutDir>windows\x86\$(Configuration)\</OutDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|x64'">
+    <OutDir>windows\x64\$(Configuration)\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|BlackBerry'">
     <OutDir>Device-$(Configuration)\</OutDir>
@@ -728,7 +771,10 @@
     <OutDir>Simulator\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <IntDir>$(Configuration)\</IntDir>
+    <IntDir>windows\x86\$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <IntDir>windows\x64\$(Configuration)\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|BlackBerry'">
     <IntDir>Device-$(Configuration)\</IntDir>
@@ -739,7 +785,10 @@
     <TargetName>lib$(ProjectName)</TargetName>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|Win32'">
-    <IntDir>$(Configuration)\</IntDir>
+    <IntDir>windows\x86\$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|x64'">
+    <IntDir>windows\x64\$(Configuration)\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|BlackBerry'">
     <IntDir>Device-$(Configuration)\</IntDir>
@@ -750,7 +799,10 @@
     <TargetName>lib$(ProjectName)</TargetName>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(Configuration)\</OutDir>
+    <OutDir>windows\x86\$(Configuration)\</OutDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>windows\x64\$(Configuration)\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|BlackBerry'">
     <OutDir>Device-$(Configuration)\</OutDir>
@@ -759,7 +811,10 @@
     <OutDir>Simulator\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <IntDir>$(Configuration)\</IntDir>
+    <IntDir>windows\x86\$(Configuration)\</IntDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <IntDir>windows\x64\$(Configuration)\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|BlackBerry'">
     <IntDir>Device-$(Configuration)\</IntDir>
@@ -785,6 +840,29 @@
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
     </Link>
+    <Lib>
+      <TargetMachine>MachineX86</TargetMachine>
+    </Lib>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <RuntimeTypeInfo>
+      </RuntimeTypeInfo>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <Lib>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Lib>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|BlackBerry'">
     <ClCompile>
@@ -841,6 +919,26 @@
       </Verbose>
     </Lib>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|x64'">
+    <ClCompile>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>_ITERATOR_DEBUG_LEVEL=0;WIN32;_DEBUG;_LIB;GAMEPLAY_MEM_LEAK_DETECTION;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <RuntimeTypeInfo>true</RuntimeTypeInfo>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+    <Lib>
+      <Verbose>
+      </Verbose>
+    </Lib>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='DebugMem|BlackBerry'">
     <ClCompile>
       <PrecompiledHeader>
@@ -892,6 +990,28 @@
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DebugInformationFormat>
+      </DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <PrecompiledHeader>
+      </PrecompiledHeader>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(ProjectDir)src;..\external-deps\lua\include;..\external-deps\bullet\include;..\external-deps\openal\include\AL;..\external-deps\alut\include\AL;..\external-deps\oggvorbis\include;..\external-deps\glew\include;..\external-deps\libpng\include;..\external-deps\zlib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <DebugInformationFormat>
+      </DebugInformationFormat>
     </ClCompile>
     <Link>
       <SubSystem>Windows</SubSystem>

+ 2 - 2
gameplay/res/shaders/colored.vert

@@ -14,7 +14,7 @@ varying vec3 v_color;										// Output Vertex Color
 
 // Uniforms
 uniform mat4 u_worldViewProjectionMatrix;					// Matrix to transform a position to clip space.
-uniform mat4 u_inverseTransposeWorldViewMatrix;				// Matrix to transform a normal to view space.
+uniform mat4 u_inverseTransposeWorldMatrix;				    // Matrix to transform a normal to view space.
 #if defined(SKINNING)
 uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];		// Array of 4x3 matrices
 #endif
@@ -68,7 +68,7 @@ void main()
     gl_Position = u_worldViewProjectionMatrix * position;
 
     // Transform normal to view space.
-    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz, u_inverseTransposeWorldViewMatrix[1].xyz, u_inverseTransposeWorldViewMatrix[2].xyz);
+    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldMatrix[0].xyz, u_inverseTransposeWorldMatrix[1].xyz, u_inverseTransposeWorldMatrix[2].xyz);
     v_normalVector = inverseTransposeWorldViewMatrix * normal;
 
     // Apply light.

+ 2 - 2
gameplay/res/shaders/lib/attributes-skinning.vert

@@ -37,6 +37,8 @@ vec4 getPosition()
     return _skinnedPosition;    
 }
 
+#if defined(LIGHTING)
+
 void skinTangentSpaceVector(vec3 vector, float blendWeight, int matrixIndex)
 {
     vec3 tmp;
@@ -70,8 +72,6 @@ vec3 getTangentSpaceVector(vec3 vector)
     return _skinnedNormal;
 }
 
-#if defined(LIGHTING)
-
 vec3 getNormal()
 {
     return getTangentSpaceVector(a_normal);

+ 2 - 2
gameplay/res/shaders/textured-bumped.vert

@@ -14,7 +14,7 @@ attribute vec4 a_blendIndices;								// Vertex blend index int u_matrixPalette
 
 // Uniforms
 uniform mat4 u_worldViewProjectionMatrix;					// Matrix to transform a position to clip space
-uniform mat4 u_inverseTransposeWorldViewMatrix;				// Matrix to transform a normal to view space
+uniform mat4 u_inverseTransposeWorldMatrix;				    // Matrix to transform a normal to view space
 #if defined(SKINNING)
 uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];		// Array of 4x3 matrices
 #endif
@@ -80,7 +80,7 @@ void main()
     gl_Position = u_worldViewProjectionMatrix * position;
 
     // Transform the normal, tangent and binormals to view space.
-    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz, u_inverseTransposeWorldViewMatrix[1].xyz, u_inverseTransposeWorldViewMatrix[2].xyz);
+    mat3 inverseTransposeWorldViewMatrix = mat3(u_inverseTransposeWorldMatrix[0].xyz, u_inverseTransposeWorldMatrix[1].xyz, u_inverseTransposeWorldMatrix[2].xyz);
     vec3 normalVector = normalize(inverseTransposeWorldViewMatrix * normal);
     
     // Create a transform to convert a vector to tangent space.

+ 2 - 2
gameplay/res/shaders/textured.vert

@@ -11,7 +11,7 @@ attribute vec4 a_blendIndices;								// Vertex blend index int u_matrixPalette
 
 // Uniforms
 uniform mat4 u_worldViewProjectionMatrix;					// Matrix to transform a position to clip space
-uniform mat4 u_inverseTransposeWorldViewMatrix;				// Matrix to transform a normal to view space
+uniform mat4 u_inverseTransposeWorldMatrix;				    // Matrix to transform a normal to view space
 #if defined(SKINNING)
 uniform vec4 u_matrixPalette[SKINNING_JOINT_COUNT * 3];		// Array of 4x3 matrices
 #endif
@@ -70,7 +70,7 @@ void main()
     gl_Position = u_worldViewProjectionMatrix * position;
 
     // Transform normal to view space.
-    mat3 normalMatrix = mat3(u_inverseTransposeWorldViewMatrix[0].xyz, u_inverseTransposeWorldViewMatrix[1].xyz, u_inverseTransposeWorldViewMatrix[2].xyz);
+    mat3 normalMatrix = mat3(u_inverseTransposeWorldMatrix[0].xyz, u_inverseTransposeWorldMatrix[1].xyz, u_inverseTransposeWorldMatrix[2].xyz);
     v_normalVector = normalMatrix * normal;
 
     // Apply light.

+ 1 - 2
gameplay/src/AbsoluteLayout.cpp

@@ -42,8 +42,7 @@ void AbsoluteLayout::update(const Container* container, const Vector2& offset)
 
     // An AbsoluteLayout does nothing to modify the layout of Controls.
     std::vector<Control*> controls = container->getControls();
-    unsigned int controlsCount = controls.size();
-    for (unsigned int i = 0; i < controlsCount; i++)
+    for (size_t i = 0, count = controls.size(); i < count; i++)
     {
         Control* control = controls[i];
         GP_ASSERT(control);

+ 1 - 1
gameplay/src/Animation.cpp

@@ -171,7 +171,7 @@ AnimationClip* Animation::getClip(unsigned int index) const
 
 unsigned int Animation::getClipCount() const
 {
-    return _clips ? _clips->size() : 0;
+    return _clips ? (unsigned int)_clips->size() : 0;
 }
 
 void Animation::play(const char* clipId)

+ 8 - 6
gameplay/src/AnimationClip.cpp

@@ -17,9 +17,8 @@ AnimationClip::AnimationClip(const char* id, Animation* animation, unsigned long
 {
     GP_ASSERT(_animation);
     GP_ASSERT(0 <= startTime && startTime <= _animation->_duration && 0 <= endTime && endTime <= _animation->_duration);
-    
-    unsigned int channelCount = _animation->_channels.size();
-    for (unsigned int i = 0; i < channelCount; i++)
+
+    for (size_t i = 0, count = _animation->_channels.size(); i < count; i++)
     {
         GP_ASSERT(_animation->_channels[i]);
         GP_ASSERT(_animation->_channels[i]->getCurve());
@@ -445,8 +444,10 @@ bool AnimationClip::update(float elapsedTime)
 
     // Add back in start time, and divide by the total animation's duration to get the actual percentage complete
     GP_ASSERT(_animation);
-    GP_ASSERT(_animation->_duration > 0);
-    float percentComplete = ((float)_startTime + currentTime) / (float)_animation->_duration;
+
+    // If the animation duration is zero (start time == end time, such as when there is only a single keyframe),
+    // then prevent a divide by zero and set percentComplete = 1.
+    float percentComplete = _animation->_duration == 0 ? 1 : ((float)_startTime + currentTime) / (float)_animation->_duration;
     
     if (isClipStateBitSet(CLIP_IS_FADING_OUT_BIT))
     {
@@ -484,7 +485,8 @@ bool AnimationClip::update(float elapsedTime)
             }
         }
         else
-        {   // Fade is done.
+        {
+            // Fade is done.
             _crossFadeToClip->_blendWeight = 1.0f;
             _blendWeight = 0.0f;
             resetClipStateBit(CLIP_IS_STARTED_BIT);            

+ 8 - 9
gameplay/src/Bundle.cpp

@@ -160,7 +160,7 @@ Bundle* Bundle::create(const char* path)
     GP_ASSERT(path);
 
     // Search the cache for this bundle.
-    for (unsigned int i = 0, count = __bundleCache.size(); i < count; ++i)
+    for (size_t i = 0, count = __bundleCache.size(); i < count; ++i)
     {
         Bundle* p = __bundleCache[i];
         GP_ASSERT(p);
@@ -272,7 +272,7 @@ Bundle::Reference* Bundle::find(const char* id) const
 
 void Bundle::clearLoadSession()
 {
-    for (unsigned int i = 0, count = _meshSkins.size(); i < count; ++i)
+    for (size_t i = 0, count = _meshSkins.size(); i < count; ++i)
     {
         SAFE_DELETE(_meshSkins[i]);
     }
@@ -1074,16 +1074,15 @@ void Bundle::resolveJointReferences(Scene* sceneContext, Node* nodeContext)
 {
     GP_ASSERT(_file);
 
-    const unsigned int skinCount = _meshSkins.size();
-    for (unsigned int i = 0; i < skinCount; ++i)
+    for (size_t i = 0, skinCount = _meshSkins.size(); i < skinCount; ++i)
     {
         MeshSkinData* skinData = _meshSkins[i];
         GP_ASSERT(skinData);
         GP_ASSERT(skinData->skin);
 
         // Resolve all joints in skin joint list.
-        const unsigned int jointCount = skinData->joints.size();
-        for (unsigned int j = 0; j < jointCount; ++j)
+        size_t jointCount = skinData->joints.size();
+        for (size_t j = 0; j < jointCount; ++j)
         {
             // TODO: Handle full xrefs (not just local # xrefs).
             std::string jointId = skinData->joints[j];
@@ -1096,7 +1095,7 @@ void Bundle::resolveJointReferences(Scene* sceneContext, Node* nodeContext)
                 {
                     Joint* joint = static_cast<Joint*>(n);
                     joint->setInverseBindPose(skinData->inverseBindPoseMatrices[j]);
-                    skinData->skin->setJoint(joint, j);
+                    skinData->skin->setJoint(joint, (unsigned int)j);
                     SAFE_RELEASE(joint);
                 }
             }
@@ -1556,7 +1555,7 @@ Bundle::MeshData* Bundle::readMeshData(const char* url)
 {
     GP_ASSERT(url);
 
-    unsigned int len = strlen(url);
+    size_t len = strlen(url);
     if (len == 0)
     {
         GP_ERROR("Mesh data URL must be non-empty.");
@@ -1565,7 +1564,7 @@ Bundle::MeshData* Bundle::readMeshData(const char* url)
 
     // Parse URL (formatted as 'bundle#id').
     std::string urlstring(url);
-    unsigned int pos = urlstring.find('#');
+    size_t pos = urlstring.find('#');
     if (pos == std::string::npos)
     {
         GP_ERROR("Invalid mesh data URL '%s' (must be of the form 'bundle#id').", url);

+ 3 - 4
gameplay/src/Container.cpp

@@ -218,7 +218,7 @@ unsigned int Container::addControl(Control* control)
         _controls.push_back(control);
         control->addRef();
         control->_parent = this;
-        return _controls.size() - 1;
+        return (unsigned int)(_controls.size() - 1);
     }
     else
     {
@@ -230,7 +230,7 @@ unsigned int Container::addControl(Control* control)
             Control* c = _controls[i];
             if (c == control)
             {
-                return i;
+                return (unsigned int)i;
             }
         }
 
@@ -696,8 +696,7 @@ void Container::updateScroll()
 
     // Calculate total width and height.
     std::vector<Control*> controls = getControls();
-    unsigned int controlsCount = controls.size();
-    for (unsigned int i = 0; i < controlsCount; i++)
+    for (size_t i = 0, controlsCount = controls.size(); i < controlsCount; i++)
     {
         Control* control = controls.at(i);
 

+ 1 - 1
gameplay/src/Effect.cpp

@@ -466,7 +466,7 @@ Uniform* Effect::getUniform(unsigned int index) const
 
 unsigned int Effect::getUniformCount() const
 {
-    return _uniforms.size();
+    return (unsigned int)_uniforms.size();
 }
 
 void Effect::setValue(Uniform* uniform, float value)

+ 1 - 2
gameplay/src/FlowLayout.cpp

@@ -52,8 +52,7 @@ void FlowLayout::update(const Container* container, const Vector2& offset)
     float tallestHeight = 0;
 
     std::vector<Control*> controls = container->getControls();
-    unsigned int controlsCount = controls.size();
-    for (unsigned int i = 0; i < controlsCount; i++)
+    for (size_t i = 0, controlsCount = controls.size(); i < controlsCount; i++)
     {
         Control* control = controls.at(i);
         GP_ASSERT(control);

+ 21 - 21
gameplay/src/Font.cpp

@@ -64,7 +64,7 @@ Font* Font::create(const char* path, const char* id)
     GP_ASSERT(path);
 
     // Search the font cache for a font with the given path and ID.
-    for (unsigned int i = 0, count = __fontCache.size(); i < count; ++i)
+    for (size_t i = 0, count = __fontCache.size(); i < count; ++i)
     {
         Font* f = __fontCache[i];
         GP_ASSERT(f);
@@ -249,7 +249,7 @@ Font::Text* Font::createText(const char* text, const Rectangle& area, const Vect
         }
         else
         {
-            tokenLength = strcspn(token, " \r\n\t");
+            tokenLength = (unsigned int)strcspn(token, " \r\n\t");
             tokenWidth = getTokenWidth(token, tokenLength, size, scale);
             iteration = 1;
             startIndex = 0;
@@ -398,7 +398,7 @@ Font::Text* Font::createText(const char* text, const Rectangle& area, const Vect
             else
             {
                 // Skip the rest of this line.
-                unsigned int tokenLength = strcspn(token, "\n");
+                size_t tokenLength = strcspn(token, "\n");
 
                 if (tokenLength > 0)
                 {                
@@ -439,8 +439,8 @@ void Font::drawText(const char* text, int x, int y, const Vector4& color, unsign
 
     while (!done)
     {
-        int length;
-        int startIndex;
+        size_t length;
+        size_t startIndex;
         int iteration;
         if (rightToLeft)
         {
@@ -490,7 +490,7 @@ void Font::drawText(const char* text, int x, int y, const Vector4& color, unsign
 
         GP_ASSERT(_glyphs);
         GP_ASSERT(_batch);
-        for (int i = startIndex; i < length && i >= 0; i += iteration)
+        for (size_t i = startIndex; i < length && i >= 0; i += iteration)
         {
             char c = 0;
             if (rightToLeft)
@@ -606,7 +606,7 @@ void Font::drawText(const char* text, const Rectangle& area, const Vector4& colo
         }
         else
         {
-            tokenLength = strcspn(token, " \r\n\t");
+            tokenLength = (unsigned int)strcspn(token, " \r\n\t");
             tokenWidth = getTokenWidth(token, tokenLength, size, scale);
             iteration = 1;
             startIndex = 0;
@@ -728,7 +728,7 @@ void Font::drawText(const char* text, const Rectangle& area, const Vector4& colo
             else
             {
                 // Skip the rest of this line.
-                unsigned int tokenLength = strcspn(token, "\n");
+                size_t tokenLength = strcspn(token, "\n");
 
                 if (tokenLength > 0)
                 {                
@@ -753,7 +753,7 @@ void Font::measureText(const char* text, unsigned int size, unsigned int* width,
     GP_ASSERT(width);
     GP_ASSERT(height);
 
-    const int length = strlen(text);
+    const size_t length = strlen(text);
     if (length == 0)
     {
         *width = 0;
@@ -776,7 +776,7 @@ void Font::measureText(const char* text, unsigned int size, unsigned int* width,
             ++token;
         }
 
-        unsigned int tokenLength = strcspn(token, "\n");
+        unsigned int tokenLength = (unsigned int)strcspn(token, "\n");
         unsigned int tokenWidth = getTokenWidth(token, tokenLength, size, scale);
         if (tokenWidth > *width)
         {
@@ -895,7 +895,7 @@ void Font::measureText(const char* text, const Rectangle& clip, unsigned int siz
             }
 
             // Measure the next token.
-            unsigned int tokenLength = strcspn(token, " \r\n\t");
+            unsigned int tokenLength = (unsigned int)strcspn(token, " \r\n\t");
             unsigned int tokenWidth = getTokenWidth(token, tokenLength, size, scale);
 
             // Wrap if necessary.
@@ -961,7 +961,7 @@ void Font::measureText(const char* text, const Rectangle& clip, unsigned int siz
             }
 
             // Measure the next line.
-            unsigned int tokenLength = strcspn(token, "\n");
+            unsigned int tokenLength = (unsigned int)strcspn(token, "\n");
             lineWidth = getTokenWidth(token, tokenLength, size, scale);
             
             // Determine horizontal position and width.
@@ -1017,7 +1017,7 @@ void Font::measureText(const char* text, const Rectangle& clip, unsigned int siz
     {
         y += vWhitespace;
     }
-
+    
     int clippedTop = 0;
     int clippedBottom = 0;
     if (!ignoreClip)
@@ -1030,7 +1030,7 @@ void Font::measureText(const char* text, const Rectangle& clip, unsigned int siz
             if (clippedBottom > 0)
             {
                 // Also need to crop empty lines above non-empty lines that have been clipped.
-                unsigned int emptyIndex = emptyLines.size() - clippedBottom;
+                size_t emptyIndex = emptyLines.size() - clippedBottom;
                 while (emptyIndex < emptyLines.size() && emptyLines[emptyIndex] == true)
                 {
                     height -= size;
@@ -1054,7 +1054,7 @@ void Font::measureText(const char* text, const Rectangle& clip, unsigned int siz
             }
 
             // Also need to crop empty lines below non-empty lines that have been clipped.
-            unsigned int emptyIndex = clippedTop;
+            size_t emptyIndex = clippedTop;
             while (emptyIndex < emptyLines.size() && emptyLines[emptyIndex] == true)
             {
                 y += size;
@@ -1209,7 +1209,7 @@ void Font::getMeasurementInfo(const char* text, const Rectangle& area, unsigned
                     break;
                 }
 
-                unsigned int tokenLength = strcspn(token, " \r\n\t");
+                unsigned int tokenLength = (unsigned int)strcspn(token, " \r\n\t");
                 tokenWidth += getTokenWidth(token, tokenLength, size, scale);
 
                 // Wrap if necessary.
@@ -1271,10 +1271,10 @@ void Font::getMeasurementInfo(const char* text, const Rectangle& area, unsigned
                     delimiter = token[0];
                 }
 
-                unsigned int tokenLength = strcspn(token, "\n");
+                unsigned int tokenLength = (unsigned int)strcspn(token, "\n");
                 if (tokenLength == 0)
                 {
-                    tokenLength = strlen(token);
+                    tokenLength = (unsigned int)strlen(token);
                 }
 
                 int lineWidth = getTokenWidth(token, tokenLength, size, scale);
@@ -1403,7 +1403,7 @@ int Font::getIndexOrLocation(const char* text, const Rectangle& area, unsigned i
         }
         else
         {
-            tokenLength = strcspn(token, " \r\n\t");
+            tokenLength = (unsigned int)strcspn(token, " \r\n\t");
             tokenWidth = getTokenWidth(token, tokenLength, size, scale);
             iteration = 1;
             startIndex = 0;
@@ -1518,7 +1518,7 @@ int Font::getIndexOrLocation(const char* text, const Rectangle& area, unsigned i
             else
             {
                 // Skip the rest of this line.
-                unsigned int tokenLength = strcspn(token, "\n");
+                unsigned int tokenLength = (unsigned int)strcspn(token, "\n");
 
                 if (tokenLength > 0)
                 {                
@@ -1788,7 +1788,7 @@ Font::Justify Font::getJustify(const char* justify)
 
 Font::Text::Text(const char* text) : _text(text ? text : ""), _vertexCount(0), _vertices(NULL), _indexCount(0), _indices(NULL)
 {
-    const int length = strlen(text);
+    const size_t length = strlen(text);
     _vertices = new SpriteBatch::SpriteVertex[length * 4];
     _indices = new unsigned short[((length - 1) * 6) + 4];
 }

+ 1 - 1
gameplay/src/Font.h

@@ -312,7 +312,7 @@ private:
     int getIndexOrLocation(const char* text, const Rectangle& clip, unsigned int size, const Vector2& inLocation, Vector2* outLocation,
                            const int destIndex = -1, Justify justify = ALIGN_TOP_LEFT, bool wrap = true, bool rightToLeft = false);
 
-    unsigned int getTokenWidth(const char* token, unsigned int length, unsigned int size, float scale);
+    unsigned int getTokenWidth(const char* token, unsigned length, unsigned int size, float scale);
 
     unsigned int getReversedTokenLength(const char* token, const char* bufStart);
 

+ 0 - 10
gameplay/src/FrameBuffer.cpp

@@ -84,12 +84,6 @@ FrameBuffer* FrameBuffer::create(const char* id, unsigned int width, unsigned in
     RenderTarget* renderTarget = NULL;
     if (width > 0 && height > 0)
     {
-        if (!isPowerOfTwo(width) | !isPowerOfTwo(height))
-        {
-            GP_ERROR("Failed to create render target for frame buffer. Width and Height must be a power of 2.");
-            return NULL;
-        }
-
         // Create a default RenderTarget with same ID.
         renderTarget = RenderTarget::create(id, width, height);
         if (renderTarget == NULL)
@@ -266,9 +260,5 @@ void FrameBuffer::bindDefault()
     __currentHandle = __defaultHandle;
 }
 
-bool FrameBuffer::isPowerOfTwo(unsigned int value)
-{
-    return (value != 0) && ((value & (value - 1)) == 0);
-}
 
 }

+ 1 - 1
gameplay/src/Game.cpp

@@ -601,7 +601,7 @@ unsigned int Game::createGamepad(const char* id, unsigned int handle, unsigned i
     Gamepad* gamepad = new Gamepad(id, handle, buttonCount, joystickCount, triggerCount);
     GP_ASSERT(gamepad);
     _gamepads->push_back(gamepad);
-    return _gamepads->size() - 1;
+    return (unsigned int)(_gamepads->size() - 1);
 }
 
 void Game::triggerGamepadEvents()

+ 1 - 1
gameplay/src/Game.inl

@@ -123,7 +123,7 @@ inline void Game::displayKeyboard(bool display)
 
 inline unsigned int Game::getGamepadCount() const
 {
-    return _gamepads->size();
+    return (unsigned int)_gamepads->size();
 }
 
 inline unsigned int Game::getGamepadsConnected()

+ 1 - 1
gameplay/src/Image.cpp

@@ -100,7 +100,7 @@ Image* Image::create(const char* path)
         return NULL;
     }
 
-    unsigned int stride = png_get_rowbytes(png, info);
+    size_t stride = png_get_rowbytes(png, info);
 
     // Allocate image data.
     image->_data = new unsigned char[stride * image->_height];

+ 3 - 3
gameplay/src/Material.cpp

@@ -18,7 +18,7 @@ Material::Material() :
 Material::~Material()
 {
     // Destroy all the techniques.
-    for (unsigned int i = 0, count = _techniques.size(); i < count; ++i)
+    for (size_t i = 0, count = _techniques.size(); i < count; ++i)
     {
         Technique* technique = _techniques[i];
         SAFE_RELEASE(technique);
@@ -126,7 +126,7 @@ Material* Material::create(const char* vshPath, const char* fshPath, const char*
 
 unsigned int Material::getTechniqueCount() const
 {
-    return _techniques.size();
+    return (unsigned int)_techniques.size();
 }
 
 Technique* Material::getTechniqueByIndex(unsigned int index) const
@@ -138,7 +138,7 @@ Technique* Material::getTechniqueByIndex(unsigned int index) const
 Technique* Material::getTechnique(const char* id) const
 {
     GP_ASSERT(id);
-    for (unsigned int i = 0, count = _techniques.size(); i < count; ++i)
+    for (size_t i = 0, count = _techniques.size(); i < count; ++i)
     {
         Technique* t = _techniques[i];
         GP_ASSERT(t);

+ 6 - 7
gameplay/src/MeshSkin.cpp

@@ -32,7 +32,7 @@ void MeshSkin::setBindShape(const float* matrix)
 
 unsigned int MeshSkin::getJointCount() const
 {
-    return _joints.size();
+    return (unsigned int)_joints.size();
 }
 
 Joint* MeshSkin::getJoint(unsigned int index) const
@@ -45,7 +45,7 @@ Joint* MeshSkin::getJoint(const char* id) const
 {
     GP_ASSERT(id);
 
-    for (unsigned int i = 0, count = _joints.size(); i < count; ++i)
+    for (size_t i = 0, count = _joints.size(); i < count; ++i)
     {
         Joint* j = _joints[i];
         if (j && j->getId() != NULL && strcmp(j->getId(), id) == 0)
@@ -158,8 +158,7 @@ Vector4* MeshSkin::getMatrixPalette() const
 {
     GP_ASSERT(_matrixPalette);
 
-    unsigned int count = _joints.size();
-    for (unsigned int i = 0; i < count; i++)
+    for (size_t i = 0, count = _joints.size(); i < count; i++)
     {
         GP_ASSERT(_joints[i]);
         _joints[i]->updateJointMatrix(getBindShape(), &_matrixPalette[i * PALETTE_ROWS]);
@@ -169,7 +168,7 @@ Vector4* MeshSkin::getMatrixPalette() const
 
 unsigned int MeshSkin::getMatrixPaletteSize() const
 {
-    return _joints.size() * PALETTE_ROWS;
+    return (unsigned int)_joints.size() * PALETTE_ROWS;
 }
 
 Model* MeshSkin::getModel() const
@@ -237,7 +236,7 @@ void MeshSkin::transformChanged(Transform* transform, long cookie)
 
 int MeshSkin::getJointIndex(Joint* joint) const
 {
-    for (unsigned int i = 0, count = _joints.size(); i < count; ++i)
+    for (size_t i = 0, count = _joints.size(); i < count; ++i)
     {
         if (_joints[i] == joint)
         {
@@ -265,7 +264,7 @@ void MeshSkin::clearJoints()
 {
     setRootJoint(NULL);
 
-    for (unsigned int i = 0, count = _joints.size(); i < count; ++i)
+    for (size_t i = 0, count = _joints.size(); i < count; ++i)
     {
         SAFE_RELEASE(_joints[i]);
     }

+ 78 - 35
gameplay/src/Model.cpp

@@ -253,6 +253,82 @@ void Model::setNode(Node* node)
     }
 }
 
+bool drawWireframe(Mesh* mesh)
+{
+    switch (mesh->getPrimitiveType())
+    {
+    case Mesh::TRIANGLES:
+        {
+            unsigned int vertexCount = mesh->getVertexCount();
+            for (unsigned int i = 0; i < vertexCount; i += 3)
+            {
+                GL_ASSERT( glDrawArrays(GL_LINE_LOOP, i, 3) );
+            }
+        }
+        return true;
+
+    case Mesh::TRIANGLE_STRIP:
+        {
+            unsigned int vertexCount = mesh->getVertexCount();
+            for (unsigned int i = 2; i < vertexCount; ++i)
+            {
+                GL_ASSERT( glDrawArrays(GL_LINE_LOOP, i-2, 3) );
+            }
+        }
+        return true;
+
+    default:
+        // not supported
+        return false;
+    }
+}
+
+bool drawWireframe(MeshPart* part)
+{
+    unsigned int indexCount = part->getIndexCount();
+    unsigned int indexSize = 0;
+    switch (part->getIndexFormat())
+    {
+    case Mesh::INDEX8:
+        indexSize = 1;
+        break;
+    case Mesh::INDEX16:
+        indexSize = 2;
+        break;
+    case Mesh::INDEX32:
+        indexSize = 4;
+        break;
+    default:
+        GP_ERROR("Unsupported index format (%d).", part->getIndexFormat());
+        return false;
+    }
+
+    switch (part->getPrimitiveType())
+    {
+    case Mesh::TRIANGLES:
+        {
+            for (unsigned int i = 0; i < indexCount; i += 3)
+            {
+                GL_ASSERT( glDrawElements(GL_LINE_LOOP, 3, part->getIndexFormat(), ((const GLvoid*)(i*indexSize))) );
+            }
+        }
+        return true;
+
+    case Mesh::TRIANGLE_STRIP:
+        {
+            for (unsigned int i = 2; i < indexCount; ++i)
+            {
+                GL_ASSERT( glDrawElements(GL_LINE_LOOP, 3, part->getIndexFormat(), ((const GLvoid*)((i-2)*indexSize))) );
+            }
+        }
+        return true;
+
+    default:
+        // not supported
+        return false;
+    }
+}
+
 void Model::draw(bool wireframe)
 {
     GP_ASSERT(_mesh);
@@ -272,15 +348,7 @@ void Model::draw(bool wireframe)
                 GP_ASSERT(pass);
                 pass->bind();
                 GL_ASSERT( glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) );
-                if (wireframe && (_mesh->getPrimitiveType() == Mesh::TRIANGLES || _mesh->getPrimitiveType() == Mesh::TRIANGLE_STRIP))
-                {
-                    unsigned int vertexCount = _mesh->getVertexCount();
-                    for (unsigned int j = 0; j < vertexCount; j += 3)
-                    {
-                        GL_ASSERT( glDrawArrays(GL_LINE_LOOP, j, 3) );
-                    }
-                }
-                else
+                if (!wireframe || !drawWireframe(_mesh))
                 {
                     GL_ASSERT( glDrawArrays(_mesh->getPrimitiveType(), 0, _mesh->getVertexCount()) );
                 }
@@ -308,32 +376,7 @@ void Model::draw(bool wireframe)
                     GP_ASSERT(pass);
                     pass->bind();
                     GL_ASSERT( glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, part->_indexBuffer) );
-                    if (wireframe && (_mesh->getPrimitiveType() == Mesh::TRIANGLES || _mesh->getPrimitiveType() == Mesh::TRIANGLE_STRIP))
-                    {
-                        unsigned int indexCount = part->getIndexCount();
-                        unsigned int indexSize = 0;
-                        switch (part->getIndexFormat())
-                        {
-                        case Mesh::INDEX8:
-                            indexSize = 1;
-                            break;
-                        case Mesh::INDEX16:
-                            indexSize = 2;
-                            break;
-                        case Mesh::INDEX32:
-                            indexSize = 4;
-                            break;
-                        default:
-                            GP_ERROR("Unsupported index format (%d).", part->getIndexFormat());
-                            continue;
-                        }
-
-                        for (unsigned int k = 0; k < indexCount; k += 3)
-                        {
-                            GL_ASSERT( glDrawElements(GL_LINE_LOOP, 3, part->getIndexFormat(), ((const GLvoid*)(k*indexSize))) );
-                        }
-                    }
-                    else
+                    if (!wireframe || !drawWireframe(part))
                     {
                         GL_ASSERT( glDrawElements(part->getPrimitiveType(), part->getIndexCount(), part->getIndexFormat(), 0) );
                     }

+ 1 - 1
gameplay/src/Node.cpp

@@ -1139,7 +1139,7 @@ PhysicsCollisionObject* Node::setCollisionObject(Properties* properties)
 
 unsigned int Node::getNumAdvertisedDescendants() const
 {
-    return _advertisedDescendants.size();
+    return (unsigned int)_advertisedDescendants.size();
 }
 
 Node* Node::getAdvertisedDescendant(unsigned int i) const

+ 5 - 5
gameplay/src/PhysicsController.cpp

@@ -567,14 +567,14 @@ void PhysicsController::update(float elapsedTime)
 
     // Update all the collision status cache entries.
     iter = _collisionStatus.begin();
-    for (; iter != _collisionStatus.end(); iter++)
+    for ( ; iter != _collisionStatus.end(); iter++)
     {
         if ((iter->second._status & DIRTY) != 0)
         {
             if ((iter->second._status & COLLISION) != 0 && iter->first.objectB)
             {
-                unsigned int size = iter->second._listeners.size();
-                for (unsigned int i = 0; i < size; i++)
+                size_t size = iter->second._listeners.size();
+                for (size_t i = 0; i < size; i++)
                 {
                     iter->second._listeners[i]->collisionEvent(PhysicsCollisionObject::CollisionListener::NOT_COLLIDING, iter->first);
                 }
@@ -1193,13 +1193,13 @@ PhysicsCollisionShape* PhysicsController::createMesh(Mesh* mesh, const Vector3&
 
     btTriangleIndexVertexArray* meshInterface = bullet_new<btTriangleIndexVertexArray>();
 
-    unsigned int partCount = data->parts.size();
+    size_t partCount = data->parts.size();
     if (partCount > 0)
     {
         PHY_ScalarType indexType = PHY_UCHAR;
         int indexStride = 0;
         Bundle::MeshPartData* meshPart = NULL;
-        for (unsigned int i = 0; i < partCount; i++)
+        for (size_t i = 0; i < partCount; i++)
         {
             meshPart = data->parts[i];
             GP_ASSERT(meshPart);

+ 2 - 2
gameplay/src/PhysicsVehicle.cpp

@@ -233,7 +233,7 @@ void PhysicsVehicle::setEnabled(bool enable)
 
 unsigned int PhysicsVehicle::getNumWheels() const
 {
-    return _wheels.size();
+    return (unsigned int)_wheels.size();
 }
 
 PhysicsVehicleWheel* PhysicsVehicle::getWheel(unsigned int i)
@@ -243,7 +243,7 @@ PhysicsVehicleWheel* PhysicsVehicle::getWheel(unsigned int i)
 
 void PhysicsVehicle::addWheel(PhysicsVehicleWheel* wheel)
 {
-    unsigned int i = _wheels.size();
+    unsigned i = (unsigned int)_wheels.size();
     _wheels.push_back(wheel);
     wheel->setHost(this, i);
     wheel->addToVehicle(_vehicle);

+ 1 - 1
gameplay/src/PlatformWindows.cpp

@@ -986,7 +986,7 @@ Platform* Platform::create(Game* game, void* attachToWindow)
         __hwnd = (HWND)__attachToWindow;
         __hdc = GetDC(__hwnd);
 
-        SetWindowLongPtr(__hwnd, GWL_WNDPROC, (LONG)(WNDPROC)__WndProc);
+        SetWindowLongPtr(__hwnd, GWLP_WNDPROC, (LONG)(WNDPROC)__WndProc);
 
         if (!initializeGL(NULL))
             goto error;

+ 5 - 8
gameplay/src/Properties.cpp

@@ -325,8 +325,7 @@ void Properties::readProperties(FILE* file)
 
 Properties::~Properties()
 {
-    unsigned int count = _namespaces.size();
-    for (unsigned int i = 0; i < count; ++i)
+    for (size_t i = 0, count = _namespaces.size(); i < count; ++i)
     {
         SAFE_DELETE(_namespaces[i]);
     }
@@ -412,8 +411,7 @@ void Properties::resolveInheritance(const char* id)
                 Properties* overrides = new Properties(*derived);
 
                 // Delete the child's data.
-                unsigned int count = derived->_namespaces.size();
-                for (unsigned int i = 0; i < count; i++)
+                for (size_t i = 0, count = derived->_namespaces.size(); i < count; i++)
                 {
                     SAFE_DELETE(derived->_namespaces[i]);
                 }
@@ -960,8 +958,7 @@ Properties* Properties::clone()
     p->_properties = _properties;
     p->_propertiesItr = p->_properties.end();
 
-    unsigned int count = _namespaces.size();
-    for (unsigned int i = 0; i < count; i++)
+    for (size_t i = 0, count = _namespaces.size(); i < count; i++)
     {
         GP_ASSERT(_namespaces[i]);
         p->_namespaces.push_back(_namespaces[i]->clone());
@@ -999,10 +996,10 @@ Properties* getPropertiesFromNamespacePath(Properties* properties, const std::ve
     // return the specified namespace or notify the user if it cannot be found.
     if (namespacePath.size() > 0)
     {
-        unsigned int size = namespacePath.size();
+        size_t size = namespacePath.size();
         properties->rewind();
         Properties* iter = properties->getNextNamespace();
-        for (unsigned int i = 0; i < size;)
+        for (size_t i = 0; i < size; )
         {
             while (true)
             {

+ 11 - 7
gameplay/src/RenderState.cpp

@@ -28,7 +28,7 @@ RenderState::~RenderState()
     SAFE_RELEASE(_state);
 
     // Destroy all the material parameters
-    for (unsigned int i = 0, count = _parameters.size(); i < count; ++i)
+    for (size_t i = 0, count = _parameters.size(); i < count; ++i)
     {
         SAFE_RELEASE(_parameters[i]);
     }
@@ -58,7 +58,7 @@ MaterialParameter* RenderState::getParameter(const char* name) const
 
     // Search for an existing parameter with this name.
     MaterialParameter* param;
-    for (unsigned int i = 0, count = _parameters.size(); i < count; ++i)
+    for (size_t i = 0, count = _parameters.size(); i < count; ++i)
     {
         param = _parameters[i];
         GP_ASSERT(param);
@@ -75,6 +75,9 @@ MaterialParameter* RenderState::getParameter(const char* name) const
     return param;
 }
 
+/**
+ * @script{ignore}
+ */
 const char* autoBindingToString(RenderState::AutoBinding autoBinding)
 {
     // NOTE: As new AutoBinding values are added, this switch statement must be updatd.
@@ -112,6 +115,9 @@ const char* autoBindingToString(RenderState::AutoBinding autoBinding)
 
     case RenderState::MATRIX_PALETTE:
         return "MATRIX_PALETTE";
+
+    default:
+        return "";
     }
 }
 
@@ -285,7 +291,7 @@ void RenderState::bind(Pass* pass)
     Effect* effect = pass->getEffect();
     while ((rs = getTopmost(rs)))
     {
-        for (unsigned int i = 0, count = rs->_parameters.size(); i < count; ++i)
+        for (size_t i = 0, count = rs->_parameters.size(); i < count; ++i)
         {
             GP_ASSERT(rs->_parameters[i]);
             rs->_parameters[i]->bind(effect);
@@ -339,14 +345,12 @@ void RenderState::cloneInto(RenderState* renderState, NodeCloneContext& context)
         renderState->_parameters.push_back(paramCopy);
     }
     renderState->_parent = _parent;
-    if (Node* node = context.findClonedNode(_nodeBinding))
-    {
-        renderState->setNodeBinding(node);
-    }
     if (_state)
     {
         renderState->setStateBlock(_state);
     }
+
+    // Note that _nodeBinding is not set here, it should be set by the caller.
 }
 
 RenderState::StateBlock::StateBlock()

+ 1 - 1
gameplay/src/RenderState.h

@@ -103,7 +103,6 @@ public:
      *      handling the auto binding.
      *
      * @see RenderState::registerAutoBindingResolver(const char*, RenderState::AutoBindingResolver)
-     *
      * @script{ignore}
      */
     typedef bool (*ResolveAutoBindingCallback) (const char* autoBinding, Node* node, MaterialParameter* parameter);
@@ -333,6 +332,7 @@ public:
      * auto bindings found in the RenderState::AutoBinding enumeration.
      *
      * @param callback Callback function for resolving parameter auto bindings.
+     * @script{ignore}
      */
     static void registerAutoBindingResolver(ResolveAutoBindingCallback callback);
 

+ 1 - 0
gameplay/src/RenderTarget.h

@@ -39,6 +39,7 @@ public:
      * and restrictions on what texture formats are supported as render targets.
      *
      * @param id The ID of the new RenderTarget.
+     * @param texture The texture for the new RenderTarget.
      *
      * @return A newly created RenderTarget.
      * @script{create}

+ 8 - 8
gameplay/src/SceneLoader.cpp

@@ -73,12 +73,12 @@ Scene* SceneLoader::loadInternal(const char* url)
     applyNodeProperties(scene, sceneProperties, SceneNodeProperty::COLLISION_OBJECT);
 
     // Apply node tags
-    for (unsigned int i = 0, sncount = _sceneNodes.size(); i < sncount; ++i)
+    for (size_t i = 0, sncount = _sceneNodes.size(); i < sncount; ++i)
     {
         SceneNode& sceneNode = _sceneNodes[i];
         for (std::map<std::string, std::string>::const_iterator itr = sceneNode._tags.begin(); itr != sceneNode._tags.end(); ++itr)
         {
-            for (unsigned int n = 0, ncount = sceneNode._nodes.size(); n < ncount; ++n)
+            for (size_t n = 0, ncount = sceneNode._nodes.size(); n < ncount; ++n)
                 sceneNode._nodes[n]->setTag(itr->first.c_str(), itr->second.c_str());
         }
     }
@@ -156,16 +156,16 @@ void SceneLoader::addSceneNodeProperty(SceneNode& sceneNode, SceneNodeProperty::
 
 void SceneLoader::applyNodeProperties(const Scene* scene, const Properties* sceneProperties, unsigned int typeFlags)
 {
-    for (unsigned int i = 0, sncount = _sceneNodes.size(); i < sncount; ++i)
+    for (size_t i = 0, sncount = _sceneNodes.size(); i < sncount; ++i)
     {
         SceneNode& sceneNode = _sceneNodes[i];
 
-        for (unsigned int p = 0, pcount = sceneNode._properties.size(); p < pcount; ++p)
+        for (size_t p = 0, pcount = sceneNode._properties.size(); p < pcount; ++p)
         {
             SceneNodeProperty& snp = sceneNode._properties[p];
             if (typeFlags & snp._type)
             {
-                for (unsigned int n = 0, ncount = sceneNode._nodes.size(); n < ncount; ++n)
+                for (size_t n = 0, ncount = sceneNode._nodes.size(); n < ncount; ++n)
                     applyNodeProperty(sceneNode, sceneNode._nodes[n], sceneProperties, snp, scene);
             }
         }
@@ -327,14 +327,14 @@ void SceneLoader::applyNodeUrls(Scene* scene)
 
     // Apply all URL node properties so that when we go to apply
     // the other node properties, the node is in the scene.
-    for (unsigned int i = 0, ncount = _sceneNodes.size(); i < ncount; ++i)
+    for (size_t i = 0, ncount = _sceneNodes.size(); i < ncount; ++i)
     {
         SceneNode& sceneNode = _sceneNodes[i];
 
         // Iterate backwards over the properties list so we can remove properties as we go
         // without danger of indexing out of bounds.
         bool hasURL = false;
-        for (int j = sceneNode._properties.size() - 1; j >= 0; --j)
+        for (int j = (int)sceneNode._properties.size() - 1; j >= 0; --j)
         {
             SceneNodeProperty& snp = sceneNode._properties[j];
             if (snp._type != SceneNodeProperty::URL)
@@ -647,7 +647,7 @@ void SceneLoader::buildReferenceTables(Properties* sceneProperties)
 void SceneLoader::createAnimations(const Scene* scene)
 {
     // Create the scene animations.
-    for (unsigned int i = 0, count = _animations.size(); i < count; i++)
+    for (size_t i = 0, count = _animations.size(); i < count; i++)
     {
         // If the target node doesn't exist in the scene, then we
         // can't do anything so we skip to the next animation.

+ 4 - 4
gameplay/src/ScriptController.cpp

@@ -79,7 +79,7 @@ void ScriptUtil::registerConstantBool(const std::string& name, bool value, const
         lua_setfield(sc->_lua, -2, name.c_str());
 
         // Pop all the parent tables off the stack.
-        int size = scopePath.size();
+        int size = (int)scopePath.size();
         lua_pop(sc->_lua, size);
     }
     else
@@ -112,7 +112,7 @@ void ScriptUtil::registerConstantNumber(const std::string& name, double value, c
         lua_setfield(sc->_lua, -2, name.c_str());
 
         // Pop all the parent tables off the stack.
-        int size = scopePath.size();
+        int size = (int)scopePath.size();
         lua_pop(sc->_lua, size);
     }
     else
@@ -145,7 +145,7 @@ void ScriptUtil::registerConstantString(const std::string& name, const std::stri
         lua_setfield(sc->_lua, -2, name.c_str());
 
         // Pop all the parent tables off the stack.
-        int size = scopePath.size();
+        int size = (int)scopePath.size();
         lua_pop(sc->_lua, size);
     }
     else
@@ -234,7 +234,7 @@ void ScriptUtil::registerClass(const char* name, const luaL_Reg* members, lua_CF
         lua_settable(sc->_lua, -3);
 
         // Pop all the parent tables off the stack.
-        int size = scopePath.size();
+        int size = (int)scopePath.size();
         lua_pop(sc->_lua, size);
     }
     else

+ 4 - 2
gameplay/src/ScriptController.h

@@ -273,12 +273,14 @@ LuaArray<double> getDoublePointer(int index);
  * @param index The stack index.
  * @param nonNull Whether the pointer must be non-null (e.g. if the parameter we 
  *      are retrieving is actually a reference or by-value parameter).
+ * @param success An out parameter that is set to true if the Lua parameter was successfully
+ *      converted to a valid object, or false if it was unable to perform a valid conversion.
  * @return The object pointer or <code>NULL</code> if the data at the stack index
  *      is not an object or if the object is not derived from the given type.
  * @script{ignore}
  */
 template <typename T>
-LuaArray<T> getObjectPointer(int index, const char* type, bool nonNull);
+LuaArray<T> getObjectPointer(int index, const char* type, bool nonNull, bool* success);
 
 /**
  * Gets a string for the given stack index.
@@ -812,7 +814,7 @@ private:
     friend ScriptUtil::LuaArray<unsigned long> ScriptUtil::getUnsignedLongPointer(int index);
     friend ScriptUtil::LuaArray<float> ScriptUtil::getFloatPointer(int index);
     friend ScriptUtil::LuaArray<double> ScriptUtil::getDoublePointer(int index);
-    template<typename T> friend ScriptUtil::LuaArray<T> ScriptUtil::getObjectPointer(int index, const char* type, bool nonNull);
+    template<typename T> friend ScriptUtil::LuaArray<T> ScriptUtil::getObjectPointer(int index, const char* type, bool nonNull, bool* success);
     friend const char* ScriptUtil::getString(int index, bool isStdString);
 
     lua_State* _lua;

+ 118 - 56
gameplay/src/ScriptController.inl

@@ -90,123 +90,185 @@ T& ScriptUtil::LuaArray<T>::operator[] (int index)
 }
 
 template<typename T>
-ScriptUtil::LuaArray<T> ScriptUtil::getObjectPointer(int index, const char* type, bool nonNull)
+ScriptUtil::LuaArray<T> ScriptUtil::getObjectPointer(int index, const char* type, bool nonNull, bool* success)
 {
+    *success = false;
+
     ScriptController* sc = Game::getInstance()->getScriptController();
+
+    // Was 'nil' passed?
     if (lua_type(sc->_lua, index) == LUA_TNIL)
     {
         if (nonNull)
         {
-            GP_ERROR("Attempting to pass NULL for required non-NULL parameter at index %d (likely a reference or by-value parameter).", index);
+            GP_WARN("Attempting to pass NULL for required non-NULL parameter at index %d (likely a reference or by-value parameter).", index);
+        }
+        else
+        {
+            // NULL values allowed
+            *success = true;
         }
 
         return LuaArray<T>((T*)NULL);
     }
-    else if (lua_type(sc->_lua, index) == LUA_TTABLE)
+
+    // Was a Lua table passed?
+    if (lua_type(sc->_lua, index) == LUA_TTABLE)
     {
+        // Array type - assume success unless we encounter a problem below.
+        *success = true;
+
         // Get the size of the array.
         lua_len(sc->_lua, index);
         int size = luaL_checkint(sc->_lua, -1);
 
         if (size <= 0)
+        {
+            // Array of size zero
             return LuaArray<T>((T*)NULL);
+        }
 
         LuaArray<T> arr(size);
 
-        // Push the first key.
-        lua_pushnil(sc->_lua);
+        // Loop through the lua table/array.
         int i = 0;
+        lua_pushnil(sc->_lua);
         for (; lua_next(sc->_lua, index) != 0 && i < size; i++)
         {
+            // Process each item in the array - make sure they are of valid types.
             void* p = lua_touserdata(sc->_lua, -1);
-            if (p != NULL)
+            if (p == NULL)
+            {
+                arr.set(i, (T*)NULL);
+            }
+            else
             {
+                bool foundMatch = false;
+
+                // Push array element metatable.
                 if (lua_getmetatable(sc->_lua, -1))
                 {
-                    // Check if it matches the type's metatable.
+                    // Push param type metatable.
                     luaL_getmetatable(sc->_lua, type);
                     if (lua_rawequal(sc->_lua, -1, -2))
                     {
-                        lua_pop(sc->_lua, 2);
-                        arr.set(i, (T*)((ScriptUtil::LuaObject*)p)->instance);
+                        // Pop param type metatable.
                         lua_pop(sc->_lua, 1);
-                        continue;
-                    }
-                    lua_pop(sc->_lua, 1);
 
-                    // Check if it matches any of the derived types' metatables.
-                    const std::vector<std::string>& types = sc->_hierarchy[type];
-                    for (unsigned int k = 0, count = types.size(); k < count; k++)
+                        // Matched the declared parameter type.
+                        arr.set(i, (T*)((ScriptUtil::LuaObject*)p)->instance);
+                        foundMatch = true;
+                    }
+                    else
                     {
-                        luaL_getmetatable(sc->_lua, types[k].c_str());
-                        if (lua_rawequal(sc->_lua, -1, -2))
+                        // Pop param type metatable.
+                        lua_pop(sc->_lua, 1);
+
+                        // Check if it matches any of the derived types' metatables.
+                        const std::vector<std::string>& types = sc->_hierarchy[type];
+                        for (size_t k = 0, count = types.size(); k < count; k++)
                         {
-                            lua_pop(sc->_lua, 2);
-                            arr.set(i, (T*)((ScriptUtil::LuaObject*)p)->instance);
+                            // Push dervied type metatable.
+                            luaL_getmetatable(sc->_lua, types[k].c_str());
+                            if (lua_rawequal(sc->_lua, -1, -2))
+                            {
+                                // Pop derived type metatable.
+                                lua_pop(sc->_lua, 1);
+
+                                // Matched a derived type.
+                                arr.set(i, (T*)((ScriptUtil::LuaObject*)p)->instance);
+                                foundMatch = true;
+                                break;
+                            }
+                            // Pop derived type metatable
                             lua_pop(sc->_lua, 1);
-                            continue;
                         }
-                        lua_pop(sc->_lua, 1);
                     }
+
+                    // Pop array element metatable.
                     lua_pop(sc->_lua, 1);
                 }
+
+                if (!foundMatch)
+                {
+                    GP_WARN("Invalid type passed for an array element for parameter index %d.", index);
+                    arr.set(i, (T*)NULL);
+                    *success = false;
+                }
             }
+
+            // Pop 'value' and key 'key' for lua_next.
+            lua_pop(sc->_lua, 1);
         }
-        
+
         return arr;
     }
-    else
+
+    // Type is not nil and not a table, so it should be USERDATA.
+    void* p = lua_touserdata(sc->_lua, index);
+    if (p != NULL)
     {
-        void* p = lua_touserdata(sc->_lua, index);
-        if (p != NULL)
+        // Push object metatable.
+        if (lua_getmetatable(sc->_lua, index))
         {
-            if (lua_getmetatable(sc->_lua, index))
+            // Push param type metatable.
+            luaL_getmetatable(sc->_lua, type);
+            if (lua_rawequal(sc->_lua, -1, -2))
+            {
+                // Pop both metatables.
+                lua_pop(sc->_lua, 2);
+
+                T* ptr = (T*)((ScriptUtil::LuaObject*)p)->instance;
+                if (ptr == NULL && nonNull)
+                {
+                    GP_WARN("Attempting to pass NULL for required non-NULL parameter at index %d (likely a reference or by-value parameter).", index);
+                    return LuaArray<T>((T*)NULL);
+                }
+
+                // Type is valid.
+                *success = true;
+                return LuaArray<T>(ptr);
+            }
+            // Pop param type metable.
+            lua_pop(sc->_lua, 1);
+
+            // Check if it matches any of the derived types' metatables.
+            const std::vector<std::string>& types = sc->_hierarchy[type];
+            for (size_t i = 0, count = types.size(); i < count; i++)
             {
-                // Check if it matches the type's metatable.
-                luaL_getmetatable(sc->_lua, type);
+                // Push derived type metatable.
+                luaL_getmetatable(sc->_lua, types[i].c_str());
                 if (lua_rawequal(sc->_lua, -1, -2))
                 {
+                    // Pop both metatables.
                     lua_pop(sc->_lua, 2);
+
                     T* ptr = (T*)((ScriptUtil::LuaObject*)p)->instance;
                     if (ptr == NULL && nonNull)
                     {
-                        GP_ERROR("Attempting to pass NULL for required non-NULL parameter at index %d (likely a reference or by-value parameter).", index);
+                        GP_WARN("Attempting to pass NULL for required non-NULL parameter at index %d (likely a reference or by-value parameter).", index);
+                        return LuaArray<T>((T*)NULL);
                     }
-                    return LuaArray<T>(ptr);
-                }
-                lua_pop(sc->_lua, 1);
 
-                // Check if it matches any of the derived types' metatables.
-                const std::vector<std::string>& types = sc->_hierarchy[type];
-                for (unsigned int i = 0, count = types.size(); i < count; i++)
-                {
-                    luaL_getmetatable(sc->_lua, types[i].c_str());
-                    if (lua_rawequal(sc->_lua, -1, -2))
-                    {
-                        lua_pop(sc->_lua, 2);
-                        T* ptr = (T*)((ScriptUtil::LuaObject*)p)->instance;
-                        if (ptr == NULL && nonNull)
-                        {
-                            GP_ERROR("Attempting to pass NULL for required non-NULL parameter at index %d (likely a reference or by-value parameter).", index);
-                        }
-                        return LuaArray<T>(ptr);
-                    }
-                    lua_pop(sc->_lua, 1);
+                    // Type is valid (matches a derived type).
+                    *success = true;
+                    return LuaArray<T>(ptr);
                 }
-            
+                // Pop derived type metatable.
                 lua_pop(sc->_lua, 1);
             }
-        }
 
-        if (nonNull)
-        {
-            GP_ERROR("Failed to retrieve a valid object pointer of type '%s' for parameter %d.", type, index);
+            // Pop object metatable.
+            lua_pop(sc->_lua, 1);
         }
-
-        return LuaArray<T>((T*)NULL);
     }
+
+    // If we made it here, type was not nil, and it could not be mapped to a valid object pointer.
+    //GP_WARN("Failed to retrieve a valid object pointer of type '%s' for parameter %d.", type, index);
+
+    return LuaArray<T>((T*)NULL);
 }
-    
+
 template<typename T> T ScriptController::executeFunction(const char* func)
 {
     executeFunctionHelper(1, func, NULL, NULL);

+ 3 - 3
gameplay/src/Technique.cpp

@@ -15,7 +15,7 @@ Technique::Technique(const char* id, Material* material)
 Technique::~Technique()
 {
     // Destroy all the passes.
-    for (unsigned int i = 0, count = _passes.size(); i < count; ++i)
+    for (size_t i = 0, count = _passes.size(); i < count; ++i)
     {
         SAFE_RELEASE(_passes[i]);
     }
@@ -28,7 +28,7 @@ const char* Technique::getId() const
 
 unsigned int Technique::getPassCount() const
 {
-    return _passes.size();
+    return (unsigned int)_passes.size();
 }
 
 Pass* Technique::getPassByIndex(unsigned int index) const
@@ -41,7 +41,7 @@ Pass* Technique::getPass(const char* id) const
 {
     GP_ASSERT(id);
 
-    for (unsigned int i = 0, count = _passes.size(); i < count; ++i)
+    for (size_t i = 0, count = _passes.size(); i < count; ++i)
     {
         Pass* pass = _passes[i];
         GP_ASSERT(pass);

+ 1 - 1
gameplay/src/TextBox.cpp

@@ -372,7 +372,7 @@ void TextBox::setCaretLocation(int x, int y)
         if (_caretLocation.x > textBounds.x + textBounds.width &&
             _caretLocation.y > textBounds.y + textBounds.height)
         {
-            font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, _text.length(),
+            font->getLocationAtIndex(_text.c_str(), _textBounds, fontSize, &_caretLocation, (unsigned int)_text.length(),
                 textAlignment, true, rightToLeft);
             return;
         }

+ 4 - 4
gameplay/src/Texture.cpp

@@ -73,7 +73,7 @@ Texture* Texture::create(const char* path, bool generateMipmaps)
     GP_ASSERT(path);
 
     // Search texture cache first.
-    for (unsigned int i = 0, count = __textureCache.size(); i < count; ++i)
+    for (size_t i = 0, count = __textureCache.size(); i < count; ++i)
     {
         Texture* t = __textureCache[i];
         GP_ASSERT(t);
@@ -228,7 +228,7 @@ Texture* Texture::createCompressedPVRTC(const char* path)
     }
 
     // Read first 4 bytes to determine PVRTC format.
-    unsigned int read;
+    size_t read;
     unsigned int version;
     read = fread(&version, sizeof(unsigned int), 1, file);
     if (read != 1)
@@ -347,7 +347,7 @@ GLubyte* Texture::readCompressedPVRTC(const char* path, FILE* file, GLsizei* wid
         unsigned int metaDataSize;
     };
 
-    unsigned int read;
+    size_t read;
 
     // Read header data.
     pvrtc_file_header header;
@@ -404,7 +404,7 @@ GLubyte* Texture::readCompressedPVRTC(const char* path, FILE* file, GLsizei* wid
     // Compute total size of data to be read.
     int w = *width;
     int h = *height;
-    unsigned int dataSize = 0;
+    size_t dataSize = 0;
     for (unsigned int level = 0; level < header.mipMapCount; ++level)
     {
         dataSize += computePVRTCDataSize(w, h, bpp);

+ 6 - 6
gameplay/src/Theme.cpp

@@ -14,25 +14,25 @@ Theme::Theme()
 Theme::~Theme()
 {
     // Destroy all the cursors, styles and , fonts.
-    for (unsigned int i = 0, count = _styles.size(); i < count; ++i)
+    for (size_t i = 0, count = _styles.size(); i < count; ++i)
     {
         Style* style = _styles[i];
         SAFE_DELETE(style);
     }
 
-    for (unsigned int i = 0, count = _images.size(); i < count; ++i)
+    for (size_t i = 0, count = _images.size(); i < count; ++i)
     {
         ThemeImage* image = _images[i];
         SAFE_RELEASE(image);
     }
 
-    for (unsigned int i = 0, count = _imageLists.size(); i < count; ++i)
+    for (size_t i = 0, count = _imageLists.size(); i < count; ++i)
     {
         ImageList* imageList = _imageLists[i];
         SAFE_RELEASE(imageList);
     }
 
-    for (unsigned int i = 0, count = _skins.size(); i < count; ++i)
+    for (size_t i = 0, count = _skins.size(); i < count; ++i)
     {
         Skin* skin = _skins[i];
         SAFE_RELEASE(skin);
@@ -54,7 +54,7 @@ Theme* Theme::create(const char* url)
     GP_ASSERT(url);
 
     // Search theme cache first.
-    for (unsigned int i = 0, count = __themeCache.size(); i < count; ++i)
+    for (size_t i = 0, count = __themeCache.size(); i < count; ++i)
     {
         Theme* t = __themeCache[i];
         if (t->_url == url)
@@ -435,7 +435,7 @@ Theme::Style* Theme::getStyle(const char* name) const
 {
     GP_ASSERT(name);
 
-    for (unsigned int i = 0, count = _styles.size(); i < count; ++i)
+    for (size_t i = 0, count = _styles.size(); i < count; ++i)
     {
         GP_ASSERT(_styles[i]);
         if (strcmp(name, _styles[i]->getId()) == 0)

+ 3 - 3
gameplay/src/Transform.cpp

@@ -59,8 +59,8 @@ void Transform::resumeTransformChanged()
     if (_suspendTransformChanged == 1)
     {
         // Call transformChanged() on all transforms in the list
-        unsigned int transformCount = _transformsChanged.size();
-        for (unsigned int i = 0; i < transformCount; i++)
+        size_t transformCount = _transformsChanged.size();
+        for (size_t i = 0; i < transformCount; i++)
         {
             Transform* t = _transformsChanged.at(i);
             GP_ASSERT(t);
@@ -70,7 +70,7 @@ void Transform::resumeTransformChanged()
         // Go through list and reset DIRTY_NOTIFY bit. The list could potentially be larger here if the 
         // transforms we were delaying calls to transformChanged() have any child nodes.
         transformCount = _transformsChanged.size();
-        for (unsigned int i = 0; i < transformCount; i++)
+        for (size_t i = 0; i < transformCount; i++)
         {
             Transform* t = _transformsChanged.at(i);
             GP_ASSERT(t);

+ 4 - 1
gameplay/src/Vector3.cpp

@@ -173,7 +173,10 @@ void Vector3::cross(const Vector3& v1, const Vector3& v2, Vector3* dst)
 {
     GP_ASSERT(dst);
 
-    MathUtil::crossVector3((const float*)&v1, (const float*)&v2, (float*)dst);
+    // NOTE: This code assumes Vector3 struct members are contiguous floats in memory.
+    // We might want to revisit this (and other areas of code that make this assumption)
+    // later to guarantee 100% safety/compatibility.
+    MathUtil::crossVector3(&v1.x, &v2.x, &dst->x);
 }
 
 float Vector3::distance(const Vector3& v) const

+ 1 - 1
gameplay/src/VertexAttributeBinding.cpp

@@ -40,7 +40,7 @@ VertexAttributeBinding* VertexAttributeBinding::create(Mesh* mesh, Effect* effec
 
     // Search for an existing vertex attribute binding that can be used.
     VertexAttributeBinding* b;
-    for (unsigned int i = 0, count = __vertexAttributeBindingCache.size(); i < count; ++i)
+    for (size_t i = 0, count = __vertexAttributeBindingCache.size(); i < count; ++i)
     {
         b = __vertexAttributeBindingCache[i];
         GP_ASSERT(b);

+ 2 - 2
gameplay/src/VertexFormat.cpp

@@ -33,7 +33,7 @@ const VertexFormat::Element& VertexFormat::getElement(unsigned int index) const
 
 unsigned int VertexFormat::getElementCount() const
 {
-    return _elements.size();
+    return (unsigned int)_elements.size();
 }
 
 unsigned int VertexFormat::getVertexSize() const
@@ -46,7 +46,7 @@ bool VertexFormat::operator == (const VertexFormat& f) const
     if (_elements.size() != f._elements.size())
         return false;
 
-    for (unsigned int i = 0, count = _elements.size(); i < count; ++i)
+    for (size_t i = 0, count = _elements.size(); i < count; ++i)
     {
         if (_elements[i] != f._elements[i])
             return false;

+ 3 - 3
gameplay/src/VerticalLayout.cpp

@@ -44,17 +44,17 @@ void VerticalLayout::update(const Container* container, const Vector2& offset)
 
     std::vector<Control*> controls = container->getControls();
 
-    unsigned int i, end, iter;
+    int i, end, iter;
     if (_bottomToTop)
     {
-        i = controls.size() - 1;
+        i = (int)controls.size() - 1;
         end = -1;
         iter = -1;
     }
     else
     {
         i = 0;
-        end = controls.size();
+        end = (int)controls.size();
         iter = 1;
     }
 

+ 43 - 61
gameplay/src/lua/lua_AIAgent.cpp

@@ -69,11 +69,9 @@ int lua_AIAgent__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgent__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -103,11 +101,9 @@ int lua_AIAgent_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgent_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -145,11 +141,9 @@ int lua_AIAgent_addScriptCallback(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_addScriptCallback - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgent_addScriptCallback - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -182,11 +176,9 @@ int lua_AIAgent_getId(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_getId - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgent_getId - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -228,11 +220,9 @@ int lua_AIAgent_getNode(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_getNode - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgent_getNode - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -265,11 +255,9 @@ int lua_AIAgent_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgent_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -311,11 +299,9 @@ int lua_AIAgent_getStateMachine(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_getStateMachine - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgent_getStateMachine - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -348,11 +334,9 @@ int lua_AIAgent_isEnabled(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_isEnabled - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgent_isEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -382,11 +366,9 @@ int lua_AIAgent_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgent_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -424,11 +406,9 @@ int lua_AIAgent_removeScriptCallback(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_removeScriptCallback - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgent_removeScriptCallback - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -462,11 +442,9 @@ int lua_AIAgent_setEnabled(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgent_setEnabled - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgent_setEnabled - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -493,18 +471,22 @@ int lua_AIAgent_setListener(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIAgent::Listener> param1 = ScriptUtil::getObjectPointer<AIAgent::Listener>(2, "AIAgentListener", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AIAgent::Listener> param1 = ScriptUtil::getObjectPointer<AIAgent::Listener>(2, "AIAgentListener", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AIAgent::Listener'.");
+                    lua_error(state);
+                }
 
                 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);
-            }
+
+            lua_pushstring(state, "lua_AIAgent_setListener - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 13 - 11
gameplay/src/lua/lua_AIAgentListener.cpp

@@ -56,11 +56,9 @@ int lua_AIAgentListener__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgentListener__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgentListener__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -87,7 +85,13 @@ int lua_AIAgentListener_messageReceived(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIMessage> param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AIMessage> param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AIMessage'.");
+                    lua_error(state);
+                }
 
                 AIAgent::Listener* instance = getInstance(state);
                 bool result = instance->messageReceived(param1);
@@ -97,11 +101,9 @@ int lua_AIAgentListener_messageReceived(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIAgentListener_messageReceived - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIAgentListener_messageReceived - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 23 - 17
gameplay/src/lua/lua_AIController.cpp

@@ -62,11 +62,9 @@ int lua_AIController_findAgent(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIController_findAgent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIController_findAgent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -93,18 +91,22 @@ int lua_AIController_sendMessage(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIMessage> param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AIMessage> param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AIMessage'.");
+                    lua_error(state);
+                }
 
                 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);
-            }
+
+            lua_pushstring(state, "lua_AIController_sendMessage - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 3:
@@ -114,7 +116,13 @@ int lua_AIController_sendMessage(lua_State* state)
                 lua_type(state, 3) == LUA_TNUMBER)
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIMessage> param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AIMessage> param1 = ScriptUtil::getObjectPointer<AIMessage>(2, "AIMessage", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AIMessage'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
                 float param2 = (float)luaL_checknumber(state, 3);
@@ -124,11 +132,9 @@ int lua_AIController_sendMessage(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIController_sendMessage - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIController_sendMessage - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 64 - 96
gameplay/src/lua/lua_AIMessage.cpp

@@ -73,11 +73,9 @@ int lua_AIMessage_getBoolean(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getBoolean - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_getBoolean - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -114,11 +112,9 @@ int lua_AIMessage_getDouble(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getDouble - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_getDouble - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -155,11 +151,9 @@ int lua_AIMessage_getFloat(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getFloat - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_getFloat - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -192,11 +186,9 @@ int lua_AIMessage_getId(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getId - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_getId - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -233,11 +225,9 @@ int lua_AIMessage_getInt(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getInt - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_getInt - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -274,11 +264,9 @@ int lua_AIMessage_getLong(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getLong - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_getLong - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -311,11 +299,9 @@ int lua_AIMessage_getParameterCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getParameterCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_getParameterCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -352,11 +338,9 @@ int lua_AIMessage_getParameterType(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getParameterType - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_getParameterType - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -389,11 +373,9 @@ int lua_AIMessage_getReceiver(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getReceiver - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_getReceiver - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -426,11 +408,9 @@ int lua_AIMessage_getSender(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getSender - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_getSender - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -467,11 +447,9 @@ int lua_AIMessage_getString(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_getString - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_getString - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -509,11 +487,9 @@ int lua_AIMessage_setBoolean(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setBoolean - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_setBoolean - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -551,11 +527,9 @@ int lua_AIMessage_setDouble(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setDouble - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_setDouble - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -593,11 +567,9 @@ int lua_AIMessage_setFloat(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setFloat - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_setFloat - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -635,11 +607,9 @@ int lua_AIMessage_setInt(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setInt - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_setInt - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -677,11 +647,9 @@ int lua_AIMessage_setLong(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setLong - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_setLong - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -719,11 +687,9 @@ int lua_AIMessage_setString(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_setString - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_setString - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -779,11 +745,9 @@ int lua_AIMessage_static_create(lua_State* 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);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_static_create - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -809,17 +773,21 @@ int lua_AIMessage_static_destroy(lua_State* state)
             if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIMessage> param1 = ScriptUtil::getObjectPointer<AIMessage>(1, "AIMessage", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AIMessage> param1 = ScriptUtil::getObjectPointer<AIMessage>(1, "AIMessage", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AIMessage'.");
+                    lua_error(state);
+                }
 
                 AIMessage::destroy(param1);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIMessage_static_destroy - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIMessage_static_destroy - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 34 - 46
gameplay/src/lua/lua_AIState.cpp

@@ -65,11 +65,9 @@ int lua_AIState__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIState__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIState__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -99,11 +97,9 @@ int lua_AIState_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIState_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIState_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -141,11 +137,9 @@ int lua_AIState_addScriptCallback(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIState_addScriptCallback - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIState_addScriptCallback - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -178,11 +172,9 @@ int lua_AIState_getId(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIState_getId - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIState_getId - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -215,11 +207,9 @@ int lua_AIState_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIState_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIState_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -249,11 +239,9 @@ int lua_AIState_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIState_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIState_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -291,11 +279,9 @@ int lua_AIState_removeScriptCallback(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIState_removeScriptCallback - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIState_removeScriptCallback - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -322,18 +308,22 @@ int lua_AIState_setListener(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIState::Listener> param1 = ScriptUtil::getObjectPointer<AIState::Listener>(2, "AIStateListener", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AIState::Listener> param1 = ScriptUtil::getObjectPointer<AIState::Listener>(2, "AIStateListener", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AIState::Listener'.");
+                    lua_error(state);
+                }
 
                 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);
-            }
+
+            lua_pushstring(state, "lua_AIState_setListener - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -377,11 +367,9 @@ int lua_AIState_static_create(lua_State* 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);
-            }
+
+            lua_pushstring(state, "lua_AIState_static_create - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 54 - 26
gameplay/src/lua/lua_AIStateListener.cpp

@@ -58,11 +58,9 @@ int lua_AIStateListener__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateListener__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIStateListener__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -127,21 +125,31 @@ int lua_AIStateListener_stateEnter(lua_State* state)
                 (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIAgent> param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AIAgent> param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AIAgent'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<AIState> param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false);
+                bool param2Valid;
+                ScriptUtil::LuaArray<AIState> param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'AIState'.");
+                    lua_error(state);
+                }
 
                 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);
-            }
+
+            lua_pushstring(state, "lua_AIStateListener_stateEnter - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -169,21 +177,31 @@ int lua_AIStateListener_stateExit(lua_State* state)
                 (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIAgent> param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AIAgent> param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AIAgent'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<AIState> param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false);
+                bool param2Valid;
+                ScriptUtil::LuaArray<AIState> param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'AIState'.");
+                    lua_error(state);
+                }
 
                 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);
-            }
+
+            lua_pushstring(state, "lua_AIStateListener_stateExit - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -212,10 +230,22 @@ int lua_AIStateListener_stateUpdate(lua_State* state)
                 lua_type(state, 4) == LUA_TNUMBER)
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIAgent> param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AIAgent> param1 = ScriptUtil::getObjectPointer<AIAgent>(2, "AIAgent", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AIAgent'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<AIState> param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false);
+                bool param2Valid;
+                ScriptUtil::LuaArray<AIState> param2 = ScriptUtil::getObjectPointer<AIState>(3, "AIState", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'AIState'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 3 off the stack.
                 float param3 = (float)luaL_checknumber(state, 4);
@@ -225,11 +255,9 @@ int lua_AIStateListener_stateUpdate(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateListener_stateUpdate - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIStateListener_stateUpdate - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 102 - 88
gameplay/src/lua/lua_AIStateMachine.cpp

@@ -45,45 +45,53 @@ int lua_AIStateMachine_addState(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
-
-                AIStateMachine* instance = getInstance(state);
-                void* returnPtr = (void*)instance->addState(param1);
-                if (returnPtr)
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
                 {
-                    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);
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<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;
                 }
+            } while (0);
 
-                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))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIState> param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false);
+                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.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<AIState> param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                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);
-            }
+                    AIStateMachine* instance = getInstance(state);
+                    instance->addState(param1);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_AIStateMachine_addState - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -125,11 +133,9 @@ int lua_AIStateMachine_getActiveState(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateMachine_getActiveState - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIStateMachine_getActiveState - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -171,11 +177,9 @@ int lua_AIStateMachine_getAgent(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateMachine_getAgent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIStateMachine_getAgent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -221,11 +225,9 @@ int lua_AIStateMachine_getState(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AIStateMachine_getState - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AIStateMachine_getState - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -252,18 +254,22 @@ int lua_AIStateMachine_removeState(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIState> param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AIState> param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AIState'.");
+                    lua_error(state);
+                }
 
                 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);
-            }
+
+            lua_pushstring(state, "lua_AIStateMachine_removeState - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -286,48 +292,56 @@ int lua_AIStateMachine_setState(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<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
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
                 {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<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;
                 }
+            } while (0);
 
-                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))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AIState> param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false);
+                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.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<AIState> param1 = ScriptUtil::getObjectPointer<AIState>(2, "AIState", false, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                AIStateMachine* instance = getInstance(state);
-                bool result = instance->setState(param1);
+                    AIStateMachine* instance = getInstance(state);
+                    bool result = instance->setState(param1);
 
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
+                    // 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);
-            }
+                    return 1;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_AIStateMachine_setState - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 15 - 25
gameplay/src/lua/lua_AbsoluteLayout.cpp

@@ -59,11 +59,9 @@ int lua_AbsoluteLayout__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AbsoluteLayout__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AbsoluteLayout__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -93,11 +91,9 @@ int lua_AbsoluteLayout_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AbsoluteLayout_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AbsoluteLayout_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -130,11 +126,9 @@ int lua_AbsoluteLayout_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AbsoluteLayout_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AbsoluteLayout_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -167,11 +161,9 @@ int lua_AbsoluteLayout_getType(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AbsoluteLayout_getType - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AbsoluteLayout_getType - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -201,11 +193,9 @@ int lua_AbsoluteLayout_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AbsoluteLayout_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AbsoluteLayout_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 124 - 144
gameplay/src/lua/lua_Animation.cpp

@@ -69,11 +69,9 @@ int lua_Animation__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -103,11 +101,9 @@ int lua_Animation_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -161,11 +157,9 @@ int lua_Animation_createClip(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_createClip - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_createClip - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -199,11 +193,9 @@ int lua_Animation_createClips(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_createClips - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_createClips - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -226,85 +218,91 @@ int lua_Animation_getClip(lua_State* state)
     {
         case 1:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            do
             {
-                Animation* instance = getInstance(state);
-                void* returnPtr = (void*)instance->getClip();
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AnimationClip");
-                    lua_setmetatable(state, -2);
-                }
-                else
+                if ((lua_type(state, 1) == LUA_TUSERDATA))
                 {
-                    lua_pushnil(state);
+                    Animation* instance = getInstance(state);
+                    void* returnPtr = (void*)instance->getClip();
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = false;
+                        luaL_getmetatable(state, "AnimationClip");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_getClip - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_Animation_getClip - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
-
-                Animation* instance = getInstance(state);
-                void* returnPtr = (void*)instance->getClip(param1);
-                if (returnPtr)
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
                 {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AnimationClip");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
+
+                    Animation* instance = getInstance(state);
+                    void* returnPtr = (void*)instance->getClip(param1);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = false;
+                        luaL_getmetatable(state, "AnimationClip");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
-
-                Animation* instance = getInstance(state);
-                void* returnPtr = (void*)instance->getClip(param1);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "AnimationClip");
-                    lua_setmetatable(state, -2);
-                }
-                else
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    lua_type(state, 2) == LUA_TNUMBER)
                 {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                    Animation* instance = getInstance(state);
+                    void* returnPtr = (void*)instance->getClip(param1);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = false;
+                        luaL_getmetatable(state, "AnimationClip");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_getClip - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_Animation_getClip - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -337,11 +335,9 @@ int lua_Animation_getClipCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_getClipCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_getClipCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -374,11 +370,9 @@ int lua_Animation_getDuration(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_getDuration - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_getDuration - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -411,11 +405,9 @@ int lua_Animation_getId(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_getId - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_getId - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -448,11 +440,9 @@ int lua_Animation_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -482,11 +472,9 @@ int lua_Animation_pause(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_pause - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_pause - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
@@ -502,11 +490,9 @@ int lua_Animation_pause(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_pause - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_pause - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -536,11 +522,9 @@ int lua_Animation_play(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_play - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_play - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
@@ -556,11 +540,9 @@ int lua_Animation_play(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_play - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_play - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -590,11 +572,9 @@ int lua_Animation_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -624,11 +604,9 @@ int lua_Animation_stop(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_stop - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_stop - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
@@ -644,11 +622,9 @@ int lua_Animation_stop(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_stop - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_stop - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -675,7 +651,13 @@ int lua_Animation_targets(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AnimationTarget> param1 = ScriptUtil::getObjectPointer<AnimationTarget>(2, "AnimationTarget", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AnimationTarget> param1 = ScriptUtil::getObjectPointer<AnimationTarget>(2, "AnimationTarget", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AnimationTarget'.");
+                    lua_error(state);
+                }
 
                 Animation* instance = getInstance(state);
                 bool result = instance->targets(param1);
@@ -685,11 +667,9 @@ int lua_Animation_targets(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Animation_targets - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Animation_targets - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 176 - 192
gameplay/src/lua/lua_AnimationClip.cpp

@@ -85,11 +85,9 @@ int lua_AnimationClip__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -112,33 +110,41 @@ int lua_AnimationClip_addBeginListener(lua_State* state)
     {
         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))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AnimationClip::Listener> param1 = ScriptUtil::getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false);
+                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.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<AnimationClip::Listener> param1 = ScriptUtil::getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    AnimationClip* instance = getInstance(state);
+                    instance->addBeginListener(param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                AnimationClip* instance = getInstance(state);
-                instance->addBeginListener(param1);
-                
-                return 0;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
+                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.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
 
-                AnimationClip* instance = getInstance(state);
-                instance->addBeginListener(param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_addBeginListener - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    AnimationClip* instance = getInstance(state);
+                    instance->addBeginListener(param1);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_AnimationClip_addBeginListener - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -161,33 +167,41 @@ int lua_AnimationClip_addEndListener(lua_State* state)
     {
         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))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AnimationClip::Listener> param1 = ScriptUtil::getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false);
+                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.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<AnimationClip::Listener> param1 = ScriptUtil::getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    AnimationClip* instance = getInstance(state);
+                    instance->addEndListener(param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                AnimationClip* instance = getInstance(state);
-                instance->addEndListener(param1);
-                
-                return 0;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
+                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.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
 
-                AnimationClip* instance = getInstance(state);
-                instance->addEndListener(param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_addEndListener - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    AnimationClip* instance = getInstance(state);
+                    instance->addEndListener(param1);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_AnimationClip_addEndListener - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -210,41 +224,49 @@ int lua_AnimationClip_addListener(lua_State* state)
     {
         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)
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AnimationClip::Listener> param1 = ScriptUtil::getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false);
-
-                // Get parameter 2 off the stack.
-                unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 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.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<AnimationClip::Listener> param1 = ScriptUtil::getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    // Get parameter 2 off the stack.
+                    unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
+
+                    AnimationClip* instance = getInstance(state);
+                    instance->addListener(param1, param2);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                AnimationClip* instance = getInstance(state);
-                instance->addListener(param1, param2);
-                
-                return 0;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                    lua_type(state, 3) == LUA_TNUMBER)
+                {
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
 
-                // Get parameter 2 off the stack.
-                unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
+                    // Get parameter 2 off the stack.
+                    unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
 
-                AnimationClip* instance = getInstance(state);
-                instance->addListener(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_addListener - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    AnimationClip* instance = getInstance(state);
+                    instance->addListener(param1, param2);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_AnimationClip_addListener - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -274,11 +296,9 @@ int lua_AnimationClip_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -306,7 +326,13 @@ int lua_AnimationClip_crossFade(lua_State* state)
                 lua_type(state, 3) == LUA_TNUMBER)
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AnimationClip> param1 = ScriptUtil::getObjectPointer<AnimationClip>(2, "AnimationClip", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AnimationClip> param1 = ScriptUtil::getObjectPointer<AnimationClip>(2, "AnimationClip", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AnimationClip'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
                 unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
@@ -316,11 +342,9 @@ int lua_AnimationClip_crossFade(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_crossFade - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_crossFade - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -353,11 +377,9 @@ int lua_AnimationClip_getActiveDuration(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_getActiveDuration - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_getActiveDuration - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -399,11 +421,9 @@ int lua_AnimationClip_getAnimation(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_getAnimation - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_getAnimation - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -436,11 +456,9 @@ int lua_AnimationClip_getBlendWeight(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_getBlendWeight - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_getBlendWeight - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -473,11 +491,9 @@ int lua_AnimationClip_getDuration(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_getDuration - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_getDuration - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -510,11 +526,9 @@ int lua_AnimationClip_getElaspedTime(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_getElaspedTime - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_getElaspedTime - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -547,11 +561,9 @@ int lua_AnimationClip_getEndTime(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_getEndTime - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_getEndTime - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -584,11 +596,9 @@ int lua_AnimationClip_getId(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_getId - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_getId - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -621,11 +631,9 @@ int lua_AnimationClip_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -658,11 +666,9 @@ int lua_AnimationClip_getRepeatCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_getRepeatCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_getRepeatCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -695,11 +701,9 @@ int lua_AnimationClip_getSpeed(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_getSpeed - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_getSpeed - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -732,11 +736,9 @@ int lua_AnimationClip_getStartTime(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_getStartTime - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_getStartTime - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -769,11 +771,9 @@ int lua_AnimationClip_isPlaying(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_isPlaying - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_isPlaying - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -803,11 +803,9 @@ int lua_AnimationClip_pause(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_pause - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_pause - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -837,11 +835,9 @@ int lua_AnimationClip_play(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_play - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_play - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -871,11 +867,9 @@ int lua_AnimationClip_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -909,11 +903,9 @@ int lua_AnimationClip_setActiveDuration(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_setActiveDuration - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_setActiveDuration - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -947,11 +939,9 @@ int lua_AnimationClip_setBlendWeight(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_setBlendWeight - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_setBlendWeight - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -985,11 +975,9 @@ int lua_AnimationClip_setRepeatCount(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_setRepeatCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_setRepeatCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1023,11 +1011,9 @@ int lua_AnimationClip_setSpeed(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_setSpeed - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_setSpeed - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1074,11 +1060,9 @@ int lua_AnimationClip_stop(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClip_stop - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClip_stop - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 13 - 11
gameplay/src/lua/lua_AnimationClipListener.cpp

@@ -58,11 +58,9 @@ int lua_AnimationClipListener__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClipListener__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClipListener__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -90,7 +88,13 @@ int lua_AnimationClipListener_animationEvent(lua_State* state)
                 (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<AnimationClip> param1 = ScriptUtil::getObjectPointer<AnimationClip>(2, "AnimationClip", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<AnimationClip> param1 = ScriptUtil::getObjectPointer<AnimationClip>(2, "AnimationClip", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'AnimationClip'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
                 AnimationClip::Listener::EventType param2 = (AnimationClip::Listener::EventType)lua_enumFromString_AnimationClipListenerEventType(luaL_checkstring(state, 3));
@@ -100,11 +104,9 @@ int lua_AnimationClipListener_animationEvent(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationClipListener_animationEvent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationClipListener_animationEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 3 - 5
gameplay/src/lua/lua_AnimationController.cpp

@@ -46,11 +46,9 @@ int lua_AnimationController_stopAllAnimations(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationController_stopAllAnimations - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationController_stopAllAnimations - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 214 - 206
gameplay/src/lua/lua_AnimationTarget.cpp

@@ -13,7 +13,7 @@ namespace gameplay
 
 void luaRegister_AnimationTarget()
 {
-    const luaL_Reg lua_members[] =
+    const luaL_Reg lua_members[] = 
     {
         {"createAnimation", lua_AnimationTarget_createAnimation},
         {"createAnimationFromBy", lua_AnimationTarget_createAnimationFromBy},
@@ -48,177 +48,187 @@ int lua_AnimationTarget_createAnimation(lua_State* state)
     {
         case 3:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<const char> param2 = ScriptUtil::getString(3, false);
-
-                AnimationTarget* instance = getInstance(state);
-                void* returnPtr = (void*)instance->createAnimation(param1, param2);
-                if (returnPtr)
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                    (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
                 {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Animation");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
+
+                    // Get parameter 2 off the stack.
+                    ScriptUtil::LuaArray<const char> param2 = ScriptUtil::getString(3, false);
+
+                    AnimationTarget* instance = getInstance(state);
+                    void* returnPtr = (void*)instance->createAnimation(param1, param2);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = false;
+                        luaL_getmetatable(state, "Animation");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TTABLE || lua_type(state, 3) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<Properties> param2 = ScriptUtil::getObjectPointer<Properties>(3, "Properties", false);
-
-                AnimationTarget* instance = getInstance(state);
-                void* returnPtr = (void*)instance->createAnimation(param1, param2);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Animation");
-                    lua_setmetatable(state, -2);
-                }
-                else
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TSTRING || 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_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
+
+                    // Get parameter 2 off the stack.
+                    bool param2Valid;
+                    ScriptUtil::LuaArray<Properties> param2 = ScriptUtil::getObjectPointer<Properties>(3, "Properties", false, &param2Valid);
+                    if (!param2Valid)
+                        break;
+
+                    AnimationTarget* instance = getInstance(state);
+                    void* returnPtr = (void*)instance->createAnimation(param1, param2);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = false;
+                        luaL_getmetatable(state, "Animation");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_createAnimation - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_AnimationTarget_createAnimation - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 7:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER &&
-                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
-                (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
-                (lua_type(state, 7) == LUA_TSTRING || lua_type(state, 7) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                int param2 = (int)luaL_checkint(state, 3);
-
-                // Get parameter 3 off the stack.
-                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
-
-                // Get parameter 4 off the stack.
-                ScriptUtil::LuaArray<unsigned int> param4 = ScriptUtil::getUnsignedIntPointer(5);
-
-                // Get parameter 5 off the stack.
-                ScriptUtil::LuaArray<float> param5 = ScriptUtil::getFloatPointer(6);
-
-                // Get parameter 6 off the stack.
-                Curve::InterpolationType param6 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 7));
-
-                AnimationTarget* instance = getInstance(state);
-                void* returnPtr = (void*)instance->createAnimation(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;
-                    luaL_getmetatable(state, "Animation");
-                    lua_setmetatable(state, -2);
-                }
-                else
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    lua_type(state, 4) == LUA_TNUMBER &&
+                    (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                    (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
+                    (lua_type(state, 7) == LUA_TSTRING || lua_type(state, 7) == LUA_TNIL))
                 {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
+
+                    // Get parameter 2 off the stack.
+                    int param2 = (int)luaL_checkint(state, 3);
+
+                    // Get parameter 3 off the stack.
+                    unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
+
+                    // Get parameter 4 off the stack.
+                    ScriptUtil::LuaArray<unsigned int> param4 = ScriptUtil::getUnsignedIntPointer(5);
+
+                    // Get parameter 5 off the stack.
+                    ScriptUtil::LuaArray<float> param5 = ScriptUtil::getFloatPointer(6);
+
+                    // Get parameter 6 off the stack.
+                    Curve::InterpolationType param6 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 7));
+
+                    AnimationTarget* instance = getInstance(state);
+                    void* returnPtr = (void*)instance->createAnimation(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;
+                        luaL_getmetatable(state, "Animation");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_createAnimation - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_AnimationTarget_createAnimation - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 9:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER &&
-                (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
-                (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
-                (lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TLIGHTUSERDATA) &&
-                (lua_type(state, 8) == LUA_TTABLE || lua_type(state, 8) == LUA_TLIGHTUSERDATA) &&
-                (lua_type(state, 9) == LUA_TSTRING || lua_type(state, 9) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
-
-                // Get parameter 2 off the stack.
-                int param2 = (int)luaL_checkint(state, 3);
-
-                // Get parameter 3 off the stack.
-                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
-
-                // Get parameter 4 off the stack.
-                ScriptUtil::LuaArray<unsigned int> param4 = ScriptUtil::getUnsignedIntPointer(5);
-
-                // Get parameter 5 off the stack.
-                ScriptUtil::LuaArray<float> param5 = ScriptUtil::getFloatPointer(6);
-
-                // Get parameter 6 off the stack.
-                ScriptUtil::LuaArray<float> param6 = ScriptUtil::getFloatPointer(7);
-
-                // Get parameter 7 off the stack.
-                ScriptUtil::LuaArray<float> param7 = ScriptUtil::getFloatPointer(8);
-
-                // Get parameter 8 off the stack.
-                Curve::InterpolationType param8 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 9));
-
-                AnimationTarget* instance = getInstance(state);
-                void* returnPtr = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6, param7, param8);
-                if (returnPtr)
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    lua_type(state, 4) == LUA_TNUMBER &&
+                    (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA) &&
+                    (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
+                    (lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TLIGHTUSERDATA) &&
+                    (lua_type(state, 8) == LUA_TTABLE || lua_type(state, 8) == LUA_TLIGHTUSERDATA) &&
+                    (lua_type(state, 9) == LUA_TSTRING || lua_type(state, 9) == LUA_TNIL))
                 {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = false;
-                    luaL_getmetatable(state, "Animation");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(2, false);
+
+                    // Get parameter 2 off the stack.
+                    int param2 = (int)luaL_checkint(state, 3);
+
+                    // Get parameter 3 off the stack.
+                    unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 4);
+
+                    // Get parameter 4 off the stack.
+                    ScriptUtil::LuaArray<unsigned int> param4 = ScriptUtil::getUnsignedIntPointer(5);
+
+                    // Get parameter 5 off the stack.
+                    ScriptUtil::LuaArray<float> param5 = ScriptUtil::getFloatPointer(6);
+
+                    // Get parameter 6 off the stack.
+                    ScriptUtil::LuaArray<float> param6 = ScriptUtil::getFloatPointer(7);
+
+                    // Get parameter 7 off the stack.
+                    ScriptUtil::LuaArray<float> param7 = ScriptUtil::getFloatPointer(8);
+
+                    // Get parameter 8 off the stack.
+                    Curve::InterpolationType param8 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 9));
+
+                    AnimationTarget* instance = getInstance(state);
+                    void* returnPtr = (void*)instance->createAnimation(param1, param2, param3, param4, param5, param6, param7, param8);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = false;
+                        luaL_getmetatable(state, "Animation");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_createAnimation - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_AnimationTarget_createAnimation - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -284,11 +294,9 @@ int lua_AnimationTarget_createAnimationFromBy(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_createAnimationFromBy - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationTarget_createAnimationFromBy - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -354,11 +362,9 @@ int lua_AnimationTarget_createAnimationFromTo(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_createAnimationFromTo - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationTarget_createAnimationFromTo - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -385,14 +391,12 @@ int lua_AnimationTarget_destroyAnimation(lua_State* state)
             {
                 AnimationTarget* instance = getInstance(state);
                 instance->destroyAnimation();
-
+                
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_destroyAnimation - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationTarget_destroyAnimation - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
@@ -405,14 +409,12 @@ int lua_AnimationTarget_destroyAnimation(lua_State* state)
 
                 AnimationTarget* instance = getInstance(state);
                 instance->destroyAnimation(param1);
-
+                
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_destroyAnimation - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationTarget_destroyAnimation - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -454,11 +456,9 @@ int lua_AnimationTarget_getAnimation(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_getAnimation - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationTarget_getAnimation - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
@@ -486,11 +486,9 @@ int lua_AnimationTarget_getAnimation(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_getAnimation - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationTarget_getAnimation - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -527,11 +525,9 @@ int lua_AnimationTarget_getAnimationPropertyComponentCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_getAnimationPropertyComponentCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationTarget_getAnimationPropertyComponentCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -562,18 +558,22 @@ int lua_AnimationTarget_getAnimationPropertyValue(lua_State* state)
                 int param1 = (int)luaL_checkint(state, 2);
 
                 // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<AnimationValue> param2 = ScriptUtil::getObjectPointer<AnimationValue>(3, "AnimationValue", false);
+                bool param2Valid;
+                ScriptUtil::LuaArray<AnimationValue> param2 = ScriptUtil::getObjectPointer<AnimationValue>(3, "AnimationValue", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'AnimationValue'.");
+                    lua_error(state);
+                }
 
                 AnimationTarget* instance = getInstance(state);
                 instance->getAnimationPropertyValue(param1, param2);
-
+                
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_getAnimationPropertyValue - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationTarget_getAnimationPropertyValue - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -604,18 +604,22 @@ int lua_AnimationTarget_setAnimationPropertyValue(lua_State* state)
                 int param1 = (int)luaL_checkint(state, 2);
 
                 // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<AnimationValue> param2 = ScriptUtil::getObjectPointer<AnimationValue>(3, "AnimationValue", false);
+                bool param2Valid;
+                ScriptUtil::LuaArray<AnimationValue> param2 = ScriptUtil::getObjectPointer<AnimationValue>(3, "AnimationValue", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'AnimationValue'.");
+                    lua_error(state);
+                }
 
                 AnimationTarget* instance = getInstance(state);
                 instance->setAnimationPropertyValue(param1, param2);
-
+                
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_setAnimationPropertyValue - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationTarget_setAnimationPropertyValue - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 4:
@@ -629,21 +633,25 @@ int lua_AnimationTarget_setAnimationPropertyValue(lua_State* state)
                 int param1 = (int)luaL_checkint(state, 2);
 
                 // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<AnimationValue> param2 = ScriptUtil::getObjectPointer<AnimationValue>(3, "AnimationValue", false);
+                bool param2Valid;
+                ScriptUtil::LuaArray<AnimationValue> param2 = ScriptUtil::getObjectPointer<AnimationValue>(3, "AnimationValue", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'AnimationValue'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 3 off the stack.
                 float param3 = (float)luaL_checknumber(state, 4);
 
                 AnimationTarget* instance = getInstance(state);
                 instance->setAnimationPropertyValue(param1, param2, param3);
-
+                
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationTarget_setAnimationPropertyValue - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationTarget_setAnimationPropertyValue - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 12 - 20
gameplay/src/lua/lua_AnimationValue.cpp

@@ -54,11 +54,9 @@ int lua_AnimationValue_getFloat(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationValue_getFloat - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationValue_getFloat - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -100,11 +98,9 @@ int lua_AnimationValue_getFloats(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationValue_getFloats - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationValue_getFloats - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -142,11 +138,9 @@ int lua_AnimationValue_setFloat(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationValue_setFloat - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationValue_setFloat - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -188,11 +182,9 @@ int lua_AnimationValue_setFloats(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AnimationValue_setFloats - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AnimationValue_setFloats - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 12 - 20
gameplay/src/lua/lua_AudioBuffer.cpp

@@ -55,11 +55,9 @@ int lua_AudioBuffer__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioBuffer__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioBuffer__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -89,11 +87,9 @@ int lua_AudioBuffer_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioBuffer_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioBuffer_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -126,11 +122,9 @@ int lua_AudioBuffer_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioBuffer_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioBuffer_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -160,11 +154,9 @@ int lua_AudioBuffer_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioBuffer_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioBuffer_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 3 - 5
gameplay/src/lua/lua_AudioController.cpp

@@ -52,11 +52,9 @@ int lua_AudioController__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioController__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioController__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 164 - 156
gameplay/src/lua/lua_AudioListener.cpp

@@ -78,11 +78,9 @@ int lua_AudioListener_getCamera(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_getCamera - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioListener_getCamera - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -115,11 +113,9 @@ int lua_AudioListener_getGain(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_getGain - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioListener_getGain - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -161,11 +157,9 @@ int lua_AudioListener_getOrientationForward(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_getOrientationForward - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioListener_getOrientationForward - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -207,11 +201,9 @@ int lua_AudioListener_getOrientationUp(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_getOrientationUp - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioListener_getOrientationUp - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -253,11 +245,9 @@ int lua_AudioListener_getPosition(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_getPosition - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioListener_getPosition - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -299,11 +289,9 @@ int lua_AudioListener_getVelocity(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_getVelocity - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioListener_getVelocity - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -330,18 +318,22 @@ int lua_AudioListener_setCamera(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Camera> param1 = ScriptUtil::getObjectPointer<Camera>(2, "Camera", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Camera> param1 = ScriptUtil::getObjectPointer<Camera>(2, "Camera", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Camera'.");
+                    lua_error(state);
+                }
 
                 AudioListener* instance = getInstance(state);
                 instance->setCamera(param1);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_setCamera - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioListener_setCamera - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -375,11 +367,9 @@ int lua_AudioListener_setGain(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_setGain - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioListener_setGain - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -402,66 +392,74 @@ int lua_AudioListener_setOrientation(lua_State* state)
     {
         case 3:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
-                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
-
-                // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
+                    (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    // Get parameter 2 off the stack.
+                    bool param2Valid;
+                    ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true, &param2Valid);
+                    if (!param2Valid)
+                        break;
+
+                    AudioListener* instance = getInstance(state);
+                    instance->setOrientation(*param1, *param2);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                AudioListener* instance = getInstance(state);
-                instance->setOrientation(*param1, *param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_setOrientation - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_AudioListener_setOrientation - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 7:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER &&
-                lua_type(state, 5) == LUA_TNUMBER &&
-                lua_type(state, 6) == LUA_TNUMBER &&
-                lua_type(state, 7) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                float param1 = (float)luaL_checknumber(state, 2);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    lua_type(state, 2) == LUA_TNUMBER &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    lua_type(state, 4) == LUA_TNUMBER &&
+                    lua_type(state, 5) == LUA_TNUMBER &&
+                    lua_type(state, 6) == LUA_TNUMBER &&
+                    lua_type(state, 7) == LUA_TNUMBER)
+                {
+                    // Get parameter 1 off the stack.
+                    float param1 = (float)luaL_checknumber(state, 2);
 
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 3);
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 3);
 
-                // Get parameter 3 off the stack.
-                float param3 = (float)luaL_checknumber(state, 4);
+                    // Get parameter 3 off the stack.
+                    float param3 = (float)luaL_checknumber(state, 4);
 
-                // Get parameter 4 off the stack.
-                float param4 = (float)luaL_checknumber(state, 5);
+                    // Get parameter 4 off the stack.
+                    float param4 = (float)luaL_checknumber(state, 5);
 
-                // Get parameter 5 off the stack.
-                float param5 = (float)luaL_checknumber(state, 6);
+                    // Get parameter 5 off the stack.
+                    float param5 = (float)luaL_checknumber(state, 6);
 
-                // Get parameter 6 off the stack.
-                float param6 = (float)luaL_checknumber(state, 7);
+                    // Get parameter 6 off the stack.
+                    float param6 = (float)luaL_checknumber(state, 7);
 
-                AudioListener* instance = getInstance(state);
-                instance->setOrientation(param1, param2, param3, param4, param5, param6);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_setOrientation - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    AudioListener* instance = getInstance(state);
+                    instance->setOrientation(param1, param2, param3, param4, param5, param6);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_AudioListener_setOrientation - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -484,50 +482,55 @@ int lua_AudioListener_setPosition(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    AudioListener* instance = getInstance(state);
+                    instance->setPosition(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                AudioListener* instance = getInstance(state);
-                instance->setPosition(*param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_setPosition - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_AudioListener_setPosition - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 4:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                float param1 = (float)luaL_checknumber(state, 2);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    lua_type(state, 2) == LUA_TNUMBER &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    lua_type(state, 4) == LUA_TNUMBER)
+                {
+                    // Get parameter 1 off the stack.
+                    float param1 = (float)luaL_checknumber(state, 2);
 
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 3);
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 3);
 
-                // Get parameter 3 off the stack.
-                float param3 = (float)luaL_checknumber(state, 4);
+                    // Get parameter 3 off the stack.
+                    float param3 = (float)luaL_checknumber(state, 4);
 
-                AudioListener* instance = getInstance(state);
-                instance->setPosition(param1, param2, param3);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_setPosition - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    AudioListener* instance = getInstance(state);
+                    instance->setPosition(param1, param2, param3);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_AudioListener_setPosition - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -550,50 +553,55 @@ int lua_AudioListener_setVelocity(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    AudioListener* instance = getInstance(state);
+                    instance->setVelocity(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                AudioListener* instance = getInstance(state);
-                instance->setVelocity(*param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_setVelocity - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_AudioListener_setVelocity - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 4:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                float param1 = (float)luaL_checknumber(state, 2);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    lua_type(state, 2) == LUA_TNUMBER &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    lua_type(state, 4) == LUA_TNUMBER)
+                {
+                    // Get parameter 1 off the stack.
+                    float param1 = (float)luaL_checknumber(state, 2);
 
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 3);
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 3);
 
-                // Get parameter 3 off the stack.
-                float param3 = (float)luaL_checknumber(state, 4);
+                    // Get parameter 3 off the stack.
+                    float param3 = (float)luaL_checknumber(state, 4);
 
-                AudioListener* instance = getInstance(state);
-                instance->setVelocity(param1, param2, param3);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AudioListener_setVelocity - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    AudioListener* instance = getInstance(state);
+                    instance->setVelocity(param1, param2, param3);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_AudioListener_setVelocity - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 140 - 163
gameplay/src/lua/lua_AudioSource.cpp

@@ -83,11 +83,9 @@ int lua_AudioSource__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -117,11 +115,9 @@ int lua_AudioSource_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -154,11 +150,9 @@ int lua_AudioSource_getGain(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_getGain - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_getGain - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -200,11 +194,9 @@ int lua_AudioSource_getNode(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_getNode - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_getNode - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -237,11 +229,9 @@ int lua_AudioSource_getPitch(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_getPitch - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_getPitch - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -274,11 +264,9 @@ int lua_AudioSource_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -311,11 +299,9 @@ int lua_AudioSource_getState(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_getState - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_getState - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -357,11 +343,9 @@ int lua_AudioSource_getVelocity(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_getVelocity - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_getVelocity - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -394,11 +378,9 @@ int lua_AudioSource_isLooped(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_isLooped - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_isLooped - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -428,11 +410,9 @@ int lua_AudioSource_pause(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_pause - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_pause - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -462,11 +442,9 @@ int lua_AudioSource_play(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_play - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_play - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -496,11 +474,9 @@ int lua_AudioSource_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -530,11 +506,9 @@ int lua_AudioSource_resume(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_resume - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_resume - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -564,11 +538,9 @@ int lua_AudioSource_rewind(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_rewind - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_rewind - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -602,11 +574,9 @@ int lua_AudioSource_setGain(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_setGain - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_setGain - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -640,11 +610,9 @@ int lua_AudioSource_setLooped(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_setLooped - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_setLooped - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -678,11 +646,9 @@ int lua_AudioSource_setPitch(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_setPitch - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_setPitch - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -705,50 +671,55 @@ int lua_AudioSource_setVelocity(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    AudioSource* instance = getInstance(state);
+                    instance->setVelocity(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                AudioSource* instance = getInstance(state);
-                instance->setVelocity(*param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_setVelocity - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_AudioSource_setVelocity - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 4:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                float param1 = (float)luaL_checknumber(state, 2);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    lua_type(state, 2) == LUA_TNUMBER &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    lua_type(state, 4) == LUA_TNUMBER)
+                {
+                    // Get parameter 1 off the stack.
+                    float param1 = (float)luaL_checknumber(state, 2);
 
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 3);
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 3);
 
-                // Get parameter 3 off the stack.
-                float param3 = (float)luaL_checknumber(state, 4);
+                    // Get parameter 3 off the stack.
+                    float param3 = (float)luaL_checknumber(state, 4);
 
-                AudioSource* instance = getInstance(state);
-                instance->setVelocity(param1, param2, param3);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_setVelocity - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    AudioSource* instance = getInstance(state);
+                    instance->setVelocity(param1, param2, param3);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_AudioSource_setVelocity - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -771,53 +742,61 @@ int lua_AudioSource_static_create(lua_State* state)
     {
         case 1:
         {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(1, false);
-
-                void* returnPtr = (void*)AudioSource::create(param1);
-                if (returnPtr)
+                if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
                 {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = true;
-                    luaL_getmetatable(state, "AudioSource");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(1, false);
+
+                    void* returnPtr = (void*)AudioSource::create(param1);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "AudioSource");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Properties> param1 = ScriptUtil::getObjectPointer<Properties>(1, "Properties", false);
-
-                void* returnPtr = (void*)AudioSource::create(param1);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = true;
-                    luaL_getmetatable(state, "AudioSource");
-                    lua_setmetatable(state, -2);
-                }
-                else
+                if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
                 {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Properties> param1 = ScriptUtil::getObjectPointer<Properties>(1, "Properties", false, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    void* returnPtr = (void*)AudioSource::create(param1);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "AudioSource");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_static_create - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_AudioSource_static_create - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -847,11 +826,9 @@ int lua_AudioSource_stop(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_AudioSource_stop - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_AudioSource_stop - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 393 - 298
gameplay/src/lua/lua_BoundingBox.cpp

@@ -64,11 +64,9 @@ int lua_BoundingBox__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_BoundingBox__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -110,116 +108,128 @@ int lua_BoundingBox__init(lua_State* state)
         }
         case 1:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(1, "BoundingBox", true);
-
-                void* returnPtr = (void*)new BoundingBox(*param1);
-                if (returnPtr)
+                if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
                 {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = true;
-                    luaL_getmetatable(state, "BoundingBox");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(1, "BoundingBox", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    void* returnPtr = (void*)new BoundingBox(*param1);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "BoundingBox");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox__init - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingBox__init - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(1, "Vector3", true);
-
-                // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
-
-                void* returnPtr = (void*)new BoundingBox(*param1, *param2);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = true;
-                    luaL_getmetatable(state, "BoundingBox");
-                    lua_setmetatable(state, -2);
-                }
-                else
+                if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
                 {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(1, "Vector3", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    // Get parameter 2 off the stack.
+                    bool param2Valid;
+                    ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param2Valid);
+                    if (!param2Valid)
+                        break;
+
+                    void* returnPtr = (void*)new BoundingBox(*param1, *param2);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "BoundingBox");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox__init - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingBox__init - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 6:
         {
-            if (lua_type(state, 1) == LUA_TNUMBER &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER &&
-                lua_type(state, 5) == LUA_TNUMBER &&
-                lua_type(state, 6) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                float param1 = (float)luaL_checknumber(state, 1);
-
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 2);
-
-                // Get parameter 3 off the stack.
-                float param3 = (float)luaL_checknumber(state, 3);
-
-                // Get parameter 4 off the stack.
-                float param4 = (float)luaL_checknumber(state, 4);
-
-                // Get parameter 5 off the stack.
-                float param5 = (float)luaL_checknumber(state, 5);
-
-                // Get parameter 6 off the stack.
-                float param6 = (float)luaL_checknumber(state, 6);
-
-                void* returnPtr = (void*)new BoundingBox(param1, param2, param3, param4, param5, param6);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = true;
-                    luaL_getmetatable(state, "BoundingBox");
-                    lua_setmetatable(state, -2);
-                }
-                else
+            do
+            {
+                if (lua_type(state, 1) == LUA_TNUMBER &&
+                    lua_type(state, 2) == LUA_TNUMBER &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    lua_type(state, 4) == LUA_TNUMBER &&
+                    lua_type(state, 5) == LUA_TNUMBER &&
+                    lua_type(state, 6) == LUA_TNUMBER)
                 {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    float param1 = (float)luaL_checknumber(state, 1);
+
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 2);
+
+                    // Get parameter 3 off the stack.
+                    float param3 = (float)luaL_checknumber(state, 3);
+
+                    // Get parameter 4 off the stack.
+                    float param4 = (float)luaL_checknumber(state, 4);
+
+                    // Get parameter 5 off the stack.
+                    float param5 = (float)luaL_checknumber(state, 5);
+
+                    // Get parameter 6 off the stack.
+                    float param6 = (float)luaL_checknumber(state, 6);
+
+                    void* returnPtr = (void*)new BoundingBox(param1, param2, param3, param4, param5, param6);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "BoundingBox");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox__init - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingBox__init - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -242,50 +252,55 @@ int lua_BoundingBox_getCenter(lua_State* state)
     {
         case 1:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA))
+            do
             {
-                BoundingBox* instance = getInstance(state);
-                void* returnPtr = (void*)new Vector3(instance->getCenter());
-                if (returnPtr)
+                if ((lua_type(state, 1) == LUA_TUSERDATA))
                 {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = true;
-                    luaL_getmetatable(state, "Vector3");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
+                    BoundingBox* instance = getInstance(state);
+                    void* returnPtr = (void*)new Vector3(instance->getCenter());
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "Vector3");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox_getCenter - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingBox_getCenter - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
+                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.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    BoundingBox* instance = getInstance(state);
+                    instance->getCenter(param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                BoundingBox* instance = getInstance(state);
-                instance->getCenter(param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox_getCenter - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingBox_getCenter - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -312,18 +327,22 @@ int lua_BoundingBox_getCorners(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
+                    lua_error(state);
+                }
 
                 BoundingBox* instance = getInstance(state);
                 instance->getCorners(param1);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox_getCorners - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_BoundingBox_getCorners - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -346,81 +365,113 @@ int lua_BoundingBox_intersects(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                BoundingBox* instance = getInstance(state);
-                bool result = instance->intersects(*param1);
+                    BoundingBox* instance = getInstance(state);
+                    bool result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                BoundingBox* instance = getInstance(state);
-                bool result = instance->intersects(*param1);
+                    BoundingBox* instance = getInstance(state);
+                    bool result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Frustum> param1 = ScriptUtil::getObjectPointer<Frustum>(2, "Frustum", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Frustum> param1 = ScriptUtil::getObjectPointer<Frustum>(2, "Frustum", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                BoundingBox* instance = getInstance(state);
-                bool result = instance->intersects(*param1);
+                    BoundingBox* instance = getInstance(state);
+                    bool result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Plane> param1 = ScriptUtil::getObjectPointer<Plane>(2, "Plane", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Plane> param1 = ScriptUtil::getObjectPointer<Plane>(2, "Plane", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                BoundingBox* instance = getInstance(state);
-                float result = instance->intersects(*param1);
+                    BoundingBox* instance = getInstance(state);
+                    float result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushnumber(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushnumber(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Ray> param1 = ScriptUtil::getObjectPointer<Ray>(2, "Ray", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Ray> param1 = ScriptUtil::getObjectPointer<Ray>(2, "Ray", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                BoundingBox* instance = getInstance(state);
-                float result = instance->intersects(*param1);
+                    BoundingBox* instance = getInstance(state);
+                    float result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushnumber(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushnumber(state, result);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox_intersects - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    return 1;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_BoundingBox_intersects - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -453,11 +504,9 @@ int lua_BoundingBox_isEmpty(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox_isEmpty - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_BoundingBox_isEmpty - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -483,7 +532,13 @@ int lua_BoundingBox_max(lua_State* state)
     if (lua_gettop(state) == 2)
     {
         // Get parameter 2 off the stack.
-        ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
+        bool param2Valid;
+        ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param2Valid);
+        if (!param2Valid)
+        {
+            lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
+            lua_error(state);
+        }
 
         instance->max = *param2;
         return 0;
@@ -518,33 +573,44 @@ int lua_BoundingBox_merge(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    BoundingBox* instance = getInstance(state);
+                    instance->merge(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                BoundingBox* instance = getInstance(state);
-                instance->merge(*param1);
-                
-                return 0;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    BoundingBox* instance = getInstance(state);
+                    instance->merge(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                BoundingBox* instance = getInstance(state);
-                instance->merge(*param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox_merge - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingBox_merge - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -570,7 +636,13 @@ int lua_BoundingBox_min(lua_State* state)
     if (lua_gettop(state) == 2)
     {
         // Get parameter 2 off the stack.
-        ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
+        bool param2Valid;
+        ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param2Valid);
+        if (!param2Valid)
+        {
+            lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
+            lua_error(state);
+        }
 
         instance->min = *param2;
         return 0;
@@ -605,97 +677,116 @@ int lua_BoundingBox_set(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    BoundingBox* instance = getInstance(state);
+                    instance->set(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                BoundingBox* instance = getInstance(state);
-                instance->set(*param1);
-                
-                return 0;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    BoundingBox* instance = getInstance(state);
+                    instance->set(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                BoundingBox* instance = getInstance(state);
-                instance->set(*param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox_set - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingBox_set - 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_TNIL) &&
-                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
-
-                // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
+                    (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    // Get parameter 2 off the stack.
+                    bool param2Valid;
+                    ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true, &param2Valid);
+                    if (!param2Valid)
+                        break;
+
+                    BoundingBox* instance = getInstance(state);
+                    instance->set(*param1, *param2);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                BoundingBox* instance = getInstance(state);
-                instance->set(*param1, *param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox_set - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingBox_set - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 7:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER &&
-                lua_type(state, 5) == LUA_TNUMBER &&
-                lua_type(state, 6) == LUA_TNUMBER &&
-                lua_type(state, 7) == LUA_TNUMBER)
-            {
-                // Get parameter 1 off the stack.
-                float param1 = (float)luaL_checknumber(state, 2);
+            do
+            {
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    lua_type(state, 2) == LUA_TNUMBER &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    lua_type(state, 4) == LUA_TNUMBER &&
+                    lua_type(state, 5) == LUA_TNUMBER &&
+                    lua_type(state, 6) == LUA_TNUMBER &&
+                    lua_type(state, 7) == LUA_TNUMBER)
+                {
+                    // Get parameter 1 off the stack.
+                    float param1 = (float)luaL_checknumber(state, 2);
 
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 3);
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 3);
 
-                // Get parameter 3 off the stack.
-                float param3 = (float)luaL_checknumber(state, 4);
+                    // Get parameter 3 off the stack.
+                    float param3 = (float)luaL_checknumber(state, 4);
 
-                // Get parameter 4 off the stack.
-                float param4 = (float)luaL_checknumber(state, 5);
+                    // Get parameter 4 off the stack.
+                    float param4 = (float)luaL_checknumber(state, 5);
 
-                // Get parameter 5 off the stack.
-                float param5 = (float)luaL_checknumber(state, 6);
+                    // Get parameter 5 off the stack.
+                    float param5 = (float)luaL_checknumber(state, 6);
 
-                // Get parameter 6 off the stack.
-                float param6 = (float)luaL_checknumber(state, 7);
+                    // Get parameter 6 off the stack.
+                    float param6 = (float)luaL_checknumber(state, 7);
 
-                BoundingBox* instance = getInstance(state);
-                instance->set(param1, param2, param3, param4, param5, param6);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox_set - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    BoundingBox* instance = getInstance(state);
+                    instance->set(param1, param2, param3, param4, param5, param6);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_BoundingBox_set - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -759,18 +850,22 @@ int lua_BoundingBox_transform(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Matrix'.");
+                    lua_error(state);
+                }
 
                 BoundingBox* instance = getInstance(state);
                 instance->transform(*param1);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingBox_transform - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_BoundingBox_transform - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 256 - 184
gameplay/src/lua/lua_BoundingSphere.cpp

@@ -61,11 +61,9 @@ int lua_BoundingSphere__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingSphere__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_BoundingSphere__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -107,66 +105,74 @@ int lua_BoundingSphere__init(lua_State* state)
         }
         case 1:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(1, "BoundingSphere", true);
-
-                void* returnPtr = (void*)new BoundingSphere(*param1);
-                if (returnPtr)
+                if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
                 {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = true;
-                    luaL_getmetatable(state, "BoundingSphere");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(1, "BoundingSphere", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    void* returnPtr = (void*)new BoundingSphere(*param1);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "BoundingSphere");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingSphere__init - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingSphere__init - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
-                lua_type(state, 2) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(1, "Vector3", true);
-
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 2);
-
-                void* returnPtr = (void*)new BoundingSphere(*param1, param2);
-                if (returnPtr)
-                {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = true;
-                    luaL_getmetatable(state, "BoundingSphere");
-                    lua_setmetatable(state, -2);
-                }
-                else
+                if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL) &&
+                    lua_type(state, 2) == LUA_TNUMBER)
                 {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(1, "Vector3", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 2);
+
+                    void* returnPtr = (void*)new BoundingSphere(*param1, param2);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "BoundingSphere");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingSphere__init - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingSphere__init - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -192,7 +198,13 @@ int lua_BoundingSphere_center(lua_State* state)
     if (lua_gettop(state) == 2)
     {
         // Get parameter 2 off the stack.
-        ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
+        bool param2Valid;
+        ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param2Valid);
+        if (!param2Valid)
+        {
+            lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
+            lua_error(state);
+        }
 
         instance->center = *param2;
         return 0;
@@ -227,81 +239,113 @@ int lua_BoundingSphere_intersects(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                BoundingSphere* instance = getInstance(state);
-                bool result = instance->intersects(*param1);
+                    BoundingSphere* instance = getInstance(state);
+                    bool result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                BoundingSphere* instance = getInstance(state);
-                bool result = instance->intersects(*param1);
+                    BoundingSphere* instance = getInstance(state);
+                    bool result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Frustum> param1 = ScriptUtil::getObjectPointer<Frustum>(2, "Frustum", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Frustum> param1 = ScriptUtil::getObjectPointer<Frustum>(2, "Frustum", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                BoundingSphere* instance = getInstance(state);
-                bool result = instance->intersects(*param1);
+                    BoundingSphere* instance = getInstance(state);
+                    bool result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Plane> param1 = ScriptUtil::getObjectPointer<Plane>(2, "Plane", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Plane> param1 = ScriptUtil::getObjectPointer<Plane>(2, "Plane", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                BoundingSphere* instance = getInstance(state);
-                float result = instance->intersects(*param1);
+                    BoundingSphere* instance = getInstance(state);
+                    float result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushnumber(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushnumber(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Ray> param1 = ScriptUtil::getObjectPointer<Ray>(2, "Ray", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Ray> param1 = ScriptUtil::getObjectPointer<Ray>(2, "Ray", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                BoundingSphere* instance = getInstance(state);
-                float result = instance->intersects(*param1);
+                    BoundingSphere* instance = getInstance(state);
+                    float result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushnumber(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushnumber(state, result);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingSphere_intersects - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    return 1;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_BoundingSphere_intersects - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -334,11 +378,9 @@ int lua_BoundingSphere_isEmpty(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingSphere_isEmpty - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_BoundingSphere_isEmpty - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -361,33 +403,44 @@ int lua_BoundingSphere_merge(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    BoundingSphere* instance = getInstance(state);
+                    instance->merge(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                BoundingSphere* instance = getInstance(state);
-                instance->merge(*param1);
-                
-                return 0;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    BoundingSphere* instance = getInstance(state);
+                    instance->merge(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                BoundingSphere* instance = getInstance(state);
-                instance->merge(*param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingSphere_merge - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingSphere_merge - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -439,57 +492,72 @@ int lua_BoundingSphere_set(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    BoundingSphere* instance = getInstance(state);
+                    instance->set(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                BoundingSphere* instance = getInstance(state);
-                instance->set(*param1);
-                
-                return 0;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    BoundingSphere* instance = getInstance(state);
+                    instance->set(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                BoundingSphere* instance = getInstance(state);
-                instance->set(*param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingSphere_set - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingSphere_set - 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_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
-
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 3);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL) &&
+                    lua_type(state, 3) == LUA_TNUMBER)
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 3);
+
+                    BoundingSphere* instance = getInstance(state);
+                    instance->set(*param1, param2);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                BoundingSphere* instance = getInstance(state);
-                instance->set(*param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingSphere_set - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_BoundingSphere_set - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -553,18 +621,22 @@ int lua_BoundingSphere_transform(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Matrix'.");
+                    lua_error(state);
+                }
 
                 BoundingSphere* instance = getInstance(state);
                 instance->transform(*param1);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_BoundingSphere_transform - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_BoundingSphere_transform - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 39 - 65
gameplay/src/lua/lua_Bundle.cpp

@@ -69,11 +69,9 @@ int lua_Bundle__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -103,11 +101,9 @@ int lua_Bundle_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -144,11 +140,9 @@ int lua_Bundle_contains(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_contains - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_contains - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -181,11 +175,9 @@ int lua_Bundle_getObjectCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_getObjectCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_getObjectCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -222,11 +214,9 @@ int lua_Bundle_getObjectId(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_getObjectId - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_getObjectId - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -259,11 +249,9 @@ int lua_Bundle_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -309,11 +297,9 @@ int lua_Bundle_loadFont(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_loadFont - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_loadFont - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -359,11 +345,9 @@ int lua_Bundle_loadMesh(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_loadMesh - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_loadMesh - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -409,11 +393,9 @@ int lua_Bundle_loadNode(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_loadNode - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_loadNode - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -455,11 +437,9 @@ int lua_Bundle_loadScene(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_loadScene - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_loadScene - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
@@ -487,11 +467,9 @@ int lua_Bundle_loadScene(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_loadScene - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_loadScene - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -521,11 +499,9 @@ int lua_Bundle_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -569,11 +545,9 @@ int lua_Bundle_static_create(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Bundle_static_create - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Bundle_static_create - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

Разница между файлами не показана из-за своего большого размера
+ 303 - 361
gameplay/src/lua/lua_Button.cpp


+ 146 - 158
gameplay/src/lua/lua_Camera.cpp

@@ -91,11 +91,9 @@ int lua_Camera__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -125,11 +123,9 @@ int lua_Camera_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -162,11 +158,9 @@ int lua_Camera_getAspectRatio(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getAspectRatio - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getAspectRatio - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -199,11 +193,9 @@ int lua_Camera_getCameraType(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getCameraType - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getCameraType - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -236,11 +228,9 @@ int lua_Camera_getFarPlane(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getFarPlane - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getFarPlane - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -273,11 +263,9 @@ int lua_Camera_getFieldOfView(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getFieldOfView - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getFieldOfView - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -319,11 +307,9 @@ int lua_Camera_getFrustum(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getFrustum - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getFrustum - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -365,11 +351,9 @@ int lua_Camera_getInverseViewMatrix(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getInverseViewMatrix - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getInverseViewMatrix - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -411,11 +395,9 @@ int lua_Camera_getInverseViewProjectionMatrix(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getInverseViewProjectionMatrix - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getInverseViewProjectionMatrix - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -448,11 +430,9 @@ int lua_Camera_getNearPlane(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getNearPlane - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getNearPlane - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -494,11 +474,9 @@ int lua_Camera_getNode(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getNode - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getNode - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -540,11 +518,9 @@ int lua_Camera_getProjectionMatrix(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getProjectionMatrix - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getProjectionMatrix - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -577,11 +553,9 @@ int lua_Camera_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -623,11 +597,9 @@ int lua_Camera_getViewMatrix(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getViewMatrix - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getViewMatrix - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -669,11 +641,9 @@ int lua_Camera_getViewProjectionMatrix(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getViewProjectionMatrix - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getViewProjectionMatrix - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -706,11 +676,9 @@ int lua_Camera_getZoomX(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getZoomX - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getZoomX - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -743,11 +711,9 @@ int lua_Camera_getZoomY(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_getZoomY - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_getZoomY - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -777,7 +743,13 @@ int lua_Camera_pickRay(lua_State* state)
                 (lua_type(state, 5) == LUA_TUSERDATA || lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Rectangle> param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Rectangle> param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Rectangle'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
                 float param2 = (float)luaL_checknumber(state, 3);
@@ -786,18 +758,22 @@ int lua_Camera_pickRay(lua_State* state)
                 float param3 = (float)luaL_checknumber(state, 4);
 
                 // Get parameter 4 off the stack.
-                ScriptUtil::LuaArray<Ray> param4 = ScriptUtil::getObjectPointer<Ray>(5, "Ray", false);
+                bool param4Valid;
+                ScriptUtil::LuaArray<Ray> param4 = ScriptUtil::getObjectPointer<Ray>(5, "Ray", false, &param4Valid);
+                if (!param4Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 4 to type 'Ray'.");
+                    lua_error(state);
+                }
 
                 Camera* instance = getInstance(state);
                 instance->pickRay(*param1, param2, param3, param4);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_pickRay - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_pickRay - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -827,10 +803,22 @@ int lua_Camera_project(lua_State* state)
                 (lua_type(state, 5) == LUA_TTABLE || lua_type(state, 5) == LUA_TLIGHTUSERDATA))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Rectangle> param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Rectangle> param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Rectangle'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true);
+                bool param2Valid;
+                ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 3 off the stack.
                 ScriptUtil::LuaArray<float> param3 = ScriptUtil::getFloatPointer(4);
@@ -843,11 +831,9 @@ int lua_Camera_project(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_project - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_project - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 6:
@@ -860,10 +846,22 @@ int lua_Camera_project(lua_State* state)
                 (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Rectangle> param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Rectangle> param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Rectangle'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true);
+                bool param2Valid;
+                ScriptUtil::LuaArray<Vector3> param2 = ScriptUtil::getObjectPointer<Vector3>(3, "Vector3", true, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector3'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 3 off the stack.
                 ScriptUtil::LuaArray<float> param3 = ScriptUtil::getFloatPointer(4);
@@ -879,11 +877,9 @@ int lua_Camera_project(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_project - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_project - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -913,11 +909,9 @@ int lua_Camera_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -951,11 +945,9 @@ int lua_Camera_setAspectRatio(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_setAspectRatio - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_setAspectRatio - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -989,11 +981,9 @@ int lua_Camera_setFarPlane(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_setFarPlane - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_setFarPlane - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1027,11 +1017,9 @@ int lua_Camera_setFieldOfView(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_setFieldOfView - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_setFieldOfView - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1065,11 +1053,9 @@ int lua_Camera_setNearPlane(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_setNearPlane - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_setNearPlane - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1103,11 +1089,9 @@ int lua_Camera_setZoomX(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_setZoomX - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_setZoomX - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1141,11 +1125,9 @@ int lua_Camera_setZoomY(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_setZoomY - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_setZoomY - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1205,11 +1187,9 @@ int lua_Camera_static_createOrthographic(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_static_createOrthographic - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_static_createOrthographic - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1265,11 +1245,9 @@ int lua_Camera_static_createPerspective(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_static_createPerspective - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_static_createPerspective - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1300,7 +1278,13 @@ int lua_Camera_unproject(lua_State* state)
                 (lua_type(state, 6) == LUA_TUSERDATA || lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Rectangle> param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Rectangle> param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Rectangle'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
                 float param2 = (float)luaL_checknumber(state, 3);
@@ -1312,18 +1296,22 @@ int lua_Camera_unproject(lua_State* state)
                 float param4 = (float)luaL_checknumber(state, 5);
 
                 // Get parameter 5 off the stack.
-                ScriptUtil::LuaArray<Vector3> param5 = ScriptUtil::getObjectPointer<Vector3>(6, "Vector3", false);
+                bool param5Valid;
+                ScriptUtil::LuaArray<Vector3> param5 = ScriptUtil::getObjectPointer<Vector3>(6, "Vector3", false, &param5Valid);
+                if (!param5Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 5 to type 'Vector3'.");
+                    lua_error(state);
+                }
 
                 Camera* instance = getInstance(state);
                 instance->unproject(*param1, param2, param3, param4, param5);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Camera_unproject - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Camera_unproject - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

Разница между файлами не показана из-за своего большого размера
+ 303 - 361
gameplay/src/lua/lua_CheckBox.cpp


Разница между файлами не показана из-за своего большого размера
+ 331 - 360
gameplay/src/lua/lua_Container.cpp


Разница между файлами не показана из-за своего большого размера
+ 303 - 361
gameplay/src/lua/lua_Control.cpp


+ 13 - 11
gameplay/src/lua/lua_ControlListener.cpp

@@ -63,11 +63,9 @@ int lua_ControlListener__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_ControlListener__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_ControlListener__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -95,7 +93,13 @@ int lua_ControlListener_controlEvent(lua_State* state)
                 (lua_type(state, 3) == LUA_TSTRING || lua_type(state, 3) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Control> param1 = ScriptUtil::getObjectPointer<Control>(2, "Control", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Control> param1 = ScriptUtil::getObjectPointer<Control>(2, "Control", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Control'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
                 Control::Listener::EventType param2 = (Control::Listener::EventType)lua_enumFromString_ControlListenerEventType(luaL_checkstring(state, 3));
@@ -105,11 +109,9 @@ int lua_ControlListener_controlEvent(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_ControlListener_controlEvent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_ControlListener_controlEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 90 - 112
gameplay/src/lua/lua_Curve.cpp

@@ -68,11 +68,9 @@ int lua_Curve__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -102,11 +100,9 @@ int lua_Curve_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -144,11 +140,9 @@ int lua_Curve_evaluate(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_evaluate - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve_evaluate - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -181,11 +175,9 @@ int lua_Curve_getComponentCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_getComponentCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve_getComponentCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -218,11 +210,9 @@ int lua_Curve_getEndTime(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_getEndTime - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve_getEndTime - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -255,11 +245,9 @@ int lua_Curve_getPointCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_getPointCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve_getPointCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -292,11 +280,9 @@ int lua_Curve_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -329,11 +315,9 @@ int lua_Curve_getStartTime(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_getStartTime - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve_getStartTime - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -363,11 +347,9 @@ int lua_Curve_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -390,74 +372,76 @@ int lua_Curve_setPoint(lua_State* state)
     {
         case 5:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
-                (lua_type(state, 5) == LUA_TSTRING || lua_type(state, 5) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    lua_type(state, 2) == LUA_TNUMBER &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
+                    (lua_type(state, 5) == LUA_TSTRING || lua_type(state, 5) == LUA_TNIL))
+                {
+                    // 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);
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 3);
 
-                // Get parameter 3 off the stack.
-                ScriptUtil::LuaArray<float> param3 = ScriptUtil::getFloatPointer(4);
+                    // Get parameter 3 off the stack.
+                    ScriptUtil::LuaArray<float> param3 = ScriptUtil::getFloatPointer(4);
 
-                // Get parameter 4 off the stack.
-                Curve::InterpolationType param4 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 5));
+                    // Get parameter 4 off the stack.
+                    Curve::InterpolationType param4 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 5));
 
-                Curve* instance = getInstance(state);
-                instance->setPoint(param1, param2, param3, param4);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_setPoint - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    Curve* instance = getInstance(state);
+                    instance->setPoint(param1, param2, param3, param4);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_Curve_setPoint - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 7:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
-                (lua_type(state, 5) == LUA_TSTRING || lua_type(state, 5) == LUA_TNIL) &&
-                (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
-                (lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TLIGHTUSERDATA))
+            do
             {
-                // Get parameter 1 off the stack.
-                unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    lua_type(state, 2) == LUA_TNUMBER &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    (lua_type(state, 4) == LUA_TTABLE || lua_type(state, 4) == LUA_TLIGHTUSERDATA) &&
+                    (lua_type(state, 5) == LUA_TSTRING || lua_type(state, 5) == LUA_TNIL) &&
+                    (lua_type(state, 6) == LUA_TTABLE || lua_type(state, 6) == LUA_TLIGHTUSERDATA) &&
+                    (lua_type(state, 7) == LUA_TTABLE || lua_type(state, 7) == LUA_TLIGHTUSERDATA))
+                {
+                    // 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);
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 3);
 
-                // Get parameter 3 off the stack.
-                ScriptUtil::LuaArray<float> param3 = ScriptUtil::getFloatPointer(4);
+                    // Get parameter 3 off the stack.
+                    ScriptUtil::LuaArray<float> param3 = ScriptUtil::getFloatPointer(4);
 
-                // Get parameter 4 off the stack.
-                Curve::InterpolationType param4 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 5));
+                    // Get parameter 4 off the stack.
+                    Curve::InterpolationType param4 = (Curve::InterpolationType)lua_enumFromString_CurveInterpolationType(luaL_checkstring(state, 5));
 
-                // Get parameter 5 off the stack.
-                ScriptUtil::LuaArray<float> param5 = ScriptUtil::getFloatPointer(6);
+                    // Get parameter 5 off the stack.
+                    ScriptUtil::LuaArray<float> param5 = ScriptUtil::getFloatPointer(6);
 
-                // Get parameter 6 off the stack.
-                ScriptUtil::LuaArray<float> param6 = ScriptUtil::getFloatPointer(7);
+                    // Get parameter 6 off the stack.
+                    ScriptUtil::LuaArray<float> param6 = ScriptUtil::getFloatPointer(7);
 
-                Curve* instance = getInstance(state);
-                instance->setPoint(param1, param2, param3, param4, param5, param6);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_setPoint - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    Curve* instance = getInstance(state);
+                    instance->setPoint(param1, param2, param3, param4, param5, param6);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_Curve_setPoint - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -503,11 +487,9 @@ int lua_Curve_setTangent(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_setTangent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve_setTangent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -555,11 +537,9 @@ int lua_Curve_static_create(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_static_create - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve_static_create - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -602,11 +582,9 @@ int lua_Curve_static_lerp(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Curve_static_lerp - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Curve_static_lerp - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 92 - 36
gameplay/src/lua/lua_DepthStencilTarget.cpp

@@ -16,8 +16,10 @@ void luaRegister_DepthStencilTarget()
     {
         {"addRef", lua_DepthStencilTarget_addRef},
         {"getFormat", lua_DepthStencilTarget_getFormat},
+        {"getHeight", lua_DepthStencilTarget_getHeight},
         {"getId", lua_DepthStencilTarget_getId},
         {"getRefCount", lua_DepthStencilTarget_getRefCount},
+        {"getWidth", lua_DepthStencilTarget_getWidth},
         {"release", lua_DepthStencilTarget_release},
         {NULL, NULL}
     };
@@ -62,11 +64,9 @@ int lua_DepthStencilTarget__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_DepthStencilTarget__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_DepthStencilTarget__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -96,11 +96,9 @@ int lua_DepthStencilTarget_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_DepthStencilTarget_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_DepthStencilTarget_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -133,11 +131,44 @@ int lua_DepthStencilTarget_getFormat(lua_State* state)
 
                 return 1;
             }
-            else
+
+            lua_pushstring(state, "lua_DepthStencilTarget_getFormat - 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_DepthStencilTarget_getHeight(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
-                lua_pushstring(state, "lua_DepthStencilTarget_getFormat - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
+                DepthStencilTarget* instance = getInstance(state);
+                unsigned int result = instance->getHeight();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
             }
+
+            lua_pushstring(state, "lua_DepthStencilTarget_getHeight - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -170,11 +201,9 @@ int lua_DepthStencilTarget_getId(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_DepthStencilTarget_getId - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_DepthStencilTarget_getId - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -207,11 +236,44 @@ int lua_DepthStencilTarget_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
+
+            lua_pushstring(state, "lua_DepthStencilTarget_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_DepthStencilTarget_getWidth(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TUSERDATA))
             {
-                lua_pushstring(state, "lua_DepthStencilTarget_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
+                DepthStencilTarget* instance = getInstance(state);
+                unsigned int result = instance->getWidth();
+
+                // Push the return value onto the stack.
+                lua_pushunsigned(state, result);
+
+                return 1;
             }
+
+            lua_pushstring(state, "lua_DepthStencilTarget_getWidth - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -241,11 +303,9 @@ int lua_DepthStencilTarget_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_DepthStencilTarget_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_DepthStencilTarget_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -301,11 +361,9 @@ int lua_DepthStencilTarget_static_create(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_DepthStencilTarget_static_create - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_DepthStencilTarget_static_create - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -349,11 +407,9 @@ int lua_DepthStencilTarget_static_getDepthStencilTarget(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_DepthStencilTarget_static_getDepthStencilTarget - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_DepthStencilTarget_static_getDepthStencilTarget - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

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

@@ -8,8 +8,10 @@ namespace gameplay
 int lua_DepthStencilTarget__gc(lua_State* state);
 int lua_DepthStencilTarget_addRef(lua_State* state);
 int lua_DepthStencilTarget_getFormat(lua_State* state);
+int lua_DepthStencilTarget_getHeight(lua_State* state);
 int lua_DepthStencilTarget_getId(lua_State* state);
 int lua_DepthStencilTarget_getRefCount(lua_State* state);
+int lua_DepthStencilTarget_getWidth(lua_State* state);
 int lua_DepthStencilTarget_release(lua_State* state);
 int lua_DepthStencilTarget_static_create(lua_State* state);
 int lua_DepthStencilTarget_static_getDepthStencilTarget(lua_State* state);

Разница между файлами не показана из-за своего большого размера
+ 519 - 364
gameplay/src/lua/lua_Effect.cpp


+ 51 - 59
gameplay/src/lua/lua_FileSystem.cpp

@@ -61,11 +61,9 @@ int lua_FileSystem__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FileSystem__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FileSystem__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -97,11 +95,9 @@ int lua_FileSystem_static_createFileFromAsset(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FileSystem_static_createFileFromAsset - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FileSystem_static_createFileFromAsset - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -136,11 +132,9 @@ int lua_FileSystem_static_fileExists(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FileSystem_static_fileExists - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FileSystem_static_fileExists - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -203,11 +197,9 @@ int lua_FileSystem_static_isAbsolutePath(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FileSystem_static_isAbsolutePath - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FileSystem_static_isAbsolutePath - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -230,29 +222,37 @@ int lua_FileSystem_static_loadResourceAliases(lua_State* state)
     {
         case 1:
         {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(1, false);
+                if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(1, false);
 
-                FileSystem::loadResourceAliases(param1);
-                
-                return 0;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Properties> param1 = ScriptUtil::getObjectPointer<Properties>(1, "Properties", false);
+                    FileSystem::loadResourceAliases(param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                FileSystem::loadResourceAliases(param1);
-                
-                return 0;
-            }
-            else
+            do
             {
-                lua_pushstring(state, "lua_FileSystem_static_loadResourceAliases - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Properties> param1 = ScriptUtil::getObjectPointer<Properties>(1, "Properties", false, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    FileSystem::loadResourceAliases(param1);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_FileSystem_static_loadResourceAliases - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -287,11 +287,9 @@ int lua_FileSystem_static_readAll(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FileSystem_static_readAll - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FileSystem_static_readAll - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
@@ -312,11 +310,9 @@ int lua_FileSystem_static_readAll(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FileSystem_static_readAll - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FileSystem_static_readAll - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -351,11 +347,9 @@ int lua_FileSystem_static_resolvePath(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FileSystem_static_resolvePath - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FileSystem_static_resolvePath - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -387,11 +381,9 @@ int lua_FileSystem_static_setResourcePath(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FileSystem_static_setResourcePath - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FileSystem_static_setResourcePath - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 15 - 25
gameplay/src/lua/lua_FlowLayout.cpp

@@ -59,11 +59,9 @@ int lua_FlowLayout__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FlowLayout__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FlowLayout__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -93,11 +91,9 @@ int lua_FlowLayout_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FlowLayout_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FlowLayout_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -130,11 +126,9 @@ int lua_FlowLayout_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FlowLayout_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FlowLayout_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -167,11 +161,9 @@ int lua_FlowLayout_getType(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FlowLayout_getType - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FlowLayout_getType - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -201,11 +193,9 @@ int lua_FlowLayout_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FlowLayout_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FlowLayout_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

Разница между файлами не показана из-за своего большого размера
+ 563 - 422
gameplay/src/lua/lua_Font.cpp


+ 9 - 15
gameplay/src/lua/lua_FontText.cpp

@@ -56,11 +56,9 @@ int lua_FontText__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FontText__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FontText__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -104,11 +102,9 @@ int lua_FontText__init(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FontText__init - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FontText__init - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -141,11 +137,9 @@ int lua_FontText_getText(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FontText_getText - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FontText_getText - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

Разница между файлами не показана из-за своего большого размера
+ 332 - 361
gameplay/src/lua/lua_Form.cpp


+ 128 - 108
gameplay/src/lua/lua_FrameBuffer.cpp

@@ -69,11 +69,9 @@ int lua_FrameBuffer__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -103,11 +101,9 @@ int lua_FrameBuffer_addRef(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_addRef - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_addRef - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -137,11 +133,9 @@ int lua_FrameBuffer_bind(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_bind - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_bind - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -183,11 +177,9 @@ int lua_FrameBuffer_getDepthStencilTarget(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_getDepthStencilTarget - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_getDepthStencilTarget - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -220,11 +212,9 @@ int lua_FrameBuffer_getHeight(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_getHeight - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_getHeight - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -257,11 +247,9 @@ int lua_FrameBuffer_getId(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_getId - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_getId - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -294,11 +282,9 @@ int lua_FrameBuffer_getRefCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_getRefCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_getRefCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -340,11 +326,9 @@ int lua_FrameBuffer_getRenderTarget(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_getRenderTarget - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_getRenderTarget - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 2:
@@ -372,11 +356,9 @@ int lua_FrameBuffer_getRenderTarget(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_getRenderTarget - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_getRenderTarget - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -409,11 +391,9 @@ int lua_FrameBuffer_getWidth(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_getWidth - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_getWidth - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -443,11 +423,9 @@ int lua_FrameBuffer_release(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_release - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_release - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -474,18 +452,22 @@ int lua_FrameBuffer_setDepthStencilTarget(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<DepthStencilTarget> param1 = ScriptUtil::getObjectPointer<DepthStencilTarget>(2, "DepthStencilTarget", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<DepthStencilTarget> param1 = ScriptUtil::getObjectPointer<DepthStencilTarget>(2, "DepthStencilTarget", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'DepthStencilTarget'.");
+                    lua_error(state);
+                }
 
                 FrameBuffer* instance = getInstance(state);
                 instance->setDepthStencilTarget(param1);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_setDepthStencilTarget - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_setDepthStencilTarget - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -512,18 +494,22 @@ int lua_FrameBuffer_setRenderTarget(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<RenderTarget> param1 = ScriptUtil::getObjectPointer<RenderTarget>(2, "RenderTarget", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<RenderTarget> param1 = ScriptUtil::getObjectPointer<RenderTarget>(2, "RenderTarget", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'RenderTarget'.");
+                    lua_error(state);
+                }
 
                 FrameBuffer* instance = getInstance(state);
                 instance->setRenderTarget(param1);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_setRenderTarget - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_setRenderTarget - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 3:
@@ -533,7 +519,13 @@ int lua_FrameBuffer_setRenderTarget(lua_State* state)
                 lua_type(state, 3) == LUA_TNUMBER)
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<RenderTarget> param1 = ScriptUtil::getObjectPointer<RenderTarget>(2, "RenderTarget", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<RenderTarget> param1 = ScriptUtil::getObjectPointer<RenderTarget>(2, "RenderTarget", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'RenderTarget'.");
+                    lua_error(state);
+                }
 
                 // Get parameter 2 off the stack.
                 unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 3);
@@ -543,11 +535,9 @@ int lua_FrameBuffer_setRenderTarget(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_setRenderTarget - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_setRenderTarget - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -593,47 +583,79 @@ int lua_FrameBuffer_static_create(lua_State* state)
     // Attempt to match the parameters to a valid binding.
     switch (paramCount)
     {
-        case 3:
+        case 1:
         {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(1, false);
-
-                // Get parameter 2 off the stack.
-                unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
-
-                // Get parameter 3 off the stack.
-                unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 3);
-
-                void* returnPtr = (void*)FrameBuffer::create(param1, param2, param3);
-                if (returnPtr)
+                if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
                 {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = true;
-                    luaL_getmetatable(state, "FrameBuffer");
-                    lua_setmetatable(state, -2);
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(1, false);
+
+                    void* returnPtr = (void*)FrameBuffer::create(param1);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "FrameBuffer");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
-                else
+            } while (0);
+
+            lua_pushstring(state, "lua_FrameBuffer_static_create - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
+            break;
+        }
+        case 3:
+        {
+            do
+            {
+                if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
+                    lua_type(state, 2) == LUA_TNUMBER &&
+                    lua_type(state, 3) == LUA_TNUMBER)
                 {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    ScriptUtil::LuaArray<const char> param1 = ScriptUtil::getString(1, false);
+
+                    // Get parameter 2 off the stack.
+                    unsigned int param2 = (unsigned int)luaL_checkunsigned(state, 2);
+
+                    // Get parameter 3 off the stack.
+                    unsigned int param3 = (unsigned int)luaL_checkunsigned(state, 3);
+
+                    void* returnPtr = (void*)FrameBuffer::create(param1, param2, param3);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "FrameBuffer");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_static_create - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_FrameBuffer_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 3).");
+            lua_pushstring(state, "Invalid number of parameters (expected 1 or 3).");
             lua_error(state);
             break;
         }
@@ -672,11 +694,9 @@ int lua_FrameBuffer_static_getFrameBuffer(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_FrameBuffer_static_getFrameBuffer - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_FrameBuffer_static_getFrameBuffer - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 234 - 185
gameplay/src/lua/lua_Frustum.cpp

@@ -61,11 +61,9 @@ int lua_Frustum__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Frustum__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -107,53 +105,64 @@ int lua_Frustum__init(lua_State* state)
         }
         case 1:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(1, "Matrix", true);
-
-                void* returnPtr = (void*)new Frustum(*param1);
-                if (returnPtr)
+                if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
                 {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = true;
-                    luaL_getmetatable(state, "Frustum");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(1, "Matrix", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    void* returnPtr = (void*)new Frustum(*param1);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "Frustum");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Frustum> param1 = ScriptUtil::getObjectPointer<Frustum>(1, "Frustum", true);
-
-                void* returnPtr = (void*)new Frustum(*param1);
-                if (returnPtr)
+                if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TNIL))
                 {
-                    ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
-                    object->instance = returnPtr;
-                    object->owns = true;
-                    luaL_getmetatable(state, "Frustum");
-                    lua_setmetatable(state, -2);
-                }
-                else
-                {
-                    lua_pushnil(state);
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Frustum> param1 = ScriptUtil::getObjectPointer<Frustum>(1, "Frustum", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    void* returnPtr = (void*)new Frustum(*param1);
+                    if (returnPtr)
+                    {
+                        ScriptUtil::LuaObject* object = (ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(ScriptUtil::LuaObject));
+                        object->instance = returnPtr;
+                        object->owns = true;
+                        luaL_getmetatable(state, "Frustum");
+                        lua_setmetatable(state, -2);
+                    }
+                    else
+                    {
+                        lua_pushnil(state);
+                    }
+
+                    return 1;
                 }
+            } while (0);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum__init - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_Frustum__init - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -195,11 +204,9 @@ int lua_Frustum_getBottom(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum_getBottom - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Frustum_getBottom - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -226,18 +233,22 @@ int lua_Frustum_getCorners(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Vector3'.");
+                    lua_error(state);
+                }
 
                 Frustum* instance = getInstance(state);
                 instance->getCorners(param1);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum_getCorners - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Frustum_getCorners - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -279,11 +290,9 @@ int lua_Frustum_getFar(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum_getFar - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Frustum_getFar - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -325,11 +334,9 @@ int lua_Frustum_getLeft(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum_getLeft - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Frustum_getLeft - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -356,18 +363,22 @@ int lua_Frustum_getMatrix(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", false, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Matrix'.");
+                    lua_error(state);
+                }
 
                 Frustum* instance = getInstance(state);
                 instance->getMatrix(param1);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum_getMatrix - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Frustum_getMatrix - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -409,11 +420,9 @@ int lua_Frustum_getNear(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum_getNear - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Frustum_getNear - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -455,11 +464,9 @@ int lua_Frustum_getRight(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum_getRight - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Frustum_getRight - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -501,11 +508,9 @@ int lua_Frustum_getTop(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum_getTop - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Frustum_getTop - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -528,112 +533,145 @@ int lua_Frustum_intersects(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Vector3> param1 = ScriptUtil::getObjectPointer<Vector3>(2, "Vector3", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                Frustum* instance = getInstance(state);
-                bool result = instance->intersects(*param1);
+                    Frustum* instance = getInstance(state);
+                    bool result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingSphere> param1 = ScriptUtil::getObjectPointer<BoundingSphere>(2, "BoundingSphere", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                Frustum* instance = getInstance(state);
-                bool result = instance->intersects(*param1);
+                    Frustum* instance = getInstance(state);
+                    bool result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<BoundingBox> param1 = ScriptUtil::getObjectPointer<BoundingBox>(2, "BoundingBox", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                Frustum* instance = getInstance(state);
-                bool result = instance->intersects(*param1);
+                    Frustum* instance = getInstance(state);
+                    bool result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Plane> param1 = ScriptUtil::getObjectPointer<Plane>(2, "Plane", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Plane> param1 = ScriptUtil::getObjectPointer<Plane>(2, "Plane", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                Frustum* instance = getInstance(state);
-                float result = instance->intersects(*param1);
+                    Frustum* instance = getInstance(state);
+                    float result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushnumber(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushnumber(state, result);
 
-                return 1;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                    return 1;
+                }
+            } while (0);
+
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Ray> param1 = ScriptUtil::getObjectPointer<Ray>(2, "Ray", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Ray> param1 = ScriptUtil::getObjectPointer<Ray>(2, "Ray", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
 
-                Frustum* instance = getInstance(state);
-                float result = instance->intersects(*param1);
+                    Frustum* instance = getInstance(state);
+                    float result = instance->intersects(*param1);
 
-                // Push the return value onto the stack.
-                lua_pushnumber(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushnumber(state, result);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum_intersects - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    return 1;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_Frustum_intersects - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 4:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                lua_type(state, 2) == LUA_TNUMBER &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                float param1 = (float)luaL_checknumber(state, 2);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    lua_type(state, 2) == LUA_TNUMBER &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    lua_type(state, 4) == LUA_TNUMBER)
+                {
+                    // Get parameter 1 off the stack.
+                    float param1 = (float)luaL_checknumber(state, 2);
 
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 3);
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 3);
 
-                // Get parameter 3 off the stack.
-                float param3 = (float)luaL_checknumber(state, 4);
+                    // Get parameter 3 off the stack.
+                    float param3 = (float)luaL_checknumber(state, 4);
 
-                Frustum* instance = getInstance(state);
-                bool result = instance->intersects(param1, param2, param3);
+                    Frustum* instance = getInstance(state);
+                    bool result = instance->intersects(param1, param2, param3);
 
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
+                    // Push the return value onto the stack.
+                    lua_pushboolean(state, result);
 
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum_intersects - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    return 1;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_Frustum_intersects - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -656,33 +694,44 @@ int lua_Frustum_set(lua_State* state)
     {
         case 2:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Frustum> param1 = ScriptUtil::getObjectPointer<Frustum>(2, "Frustum", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Frustum> param1 = ScriptUtil::getObjectPointer<Frustum>(2, "Frustum", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    Frustum* instance = getInstance(state);
+                    instance->set(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                Frustum* instance = getInstance(state);
-                instance->set(*param1);
-                
-                return 0;
-            }
-            else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+            do
             {
-                // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true);
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
+                {
+                    // Get parameter 1 off the stack.
+                    bool param1Valid;
+                    ScriptUtil::LuaArray<Matrix> param1 = ScriptUtil::getObjectPointer<Matrix>(2, "Matrix", true, &param1Valid);
+                    if (!param1Valid)
+                        break;
+
+                    Frustum* instance = getInstance(state);
+                    instance->set(*param1);
+                    
+                    return 0;
+                }
+            } while (0);
 
-                Frustum* instance = getInstance(state);
-                instance->set(*param1);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Frustum_set - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+            lua_pushstring(state, "lua_Frustum_set - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 218 - 297
gameplay/src/lua/lua_Game.cpp

@@ -116,11 +116,9 @@ int lua_Game__gc(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game__gc - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game__gc - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -153,11 +151,9 @@ int lua_Game_canExit(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_canExit - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_canExit - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -180,78 +176,83 @@ int lua_Game_clear(lua_State* state)
     {
         case 5:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
-                lua_type(state, 4) == LUA_TNUMBER &&
-                lua_type(state, 5) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                Game::ClearFlags param1 = (Game::ClearFlags)lua_enumFromString_GameClearFlags(luaL_checkstring(state, 2));
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                    (lua_type(state, 3) == LUA_TUSERDATA || lua_type(state, 3) == LUA_TNIL) &&
+                    lua_type(state, 4) == LUA_TNUMBER &&
+                    lua_type(state, 5) == LUA_TNUMBER)
+                {
+                    // Get parameter 1 off the stack.
+                    Game::ClearFlags param1 = (Game::ClearFlags)lua_enumFromString_GameClearFlags(luaL_checkstring(state, 2));
 
-                // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<Vector4> param2 = ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", true);
+                    // Get parameter 2 off the stack.
+                    bool param2Valid;
+                    ScriptUtil::LuaArray<Vector4> param2 = ScriptUtil::getObjectPointer<Vector4>(3, "Vector4", true, &param2Valid);
+                    if (!param2Valid)
+                        break;
 
-                // Get parameter 3 off the stack.
-                float param3 = (float)luaL_checknumber(state, 4);
+                    // Get parameter 3 off the stack.
+                    float param3 = (float)luaL_checknumber(state, 4);
 
-                // Get parameter 4 off the stack.
-                int param4 = (int)luaL_checkint(state, 5);
+                    // Get parameter 4 off the stack.
+                    int param4 = (int)luaL_checkint(state, 5);
 
-                Game* instance = getInstance(state);
-                instance->clear(param1, *param2, param3, param4);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Game_clear - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    Game* instance = getInstance(state);
+                    instance->clear(param1, *param2, param3, param4);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_Game_clear - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         case 8:
         {
-            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
-                lua_type(state, 3) == LUA_TNUMBER &&
-                lua_type(state, 4) == LUA_TNUMBER &&
-                lua_type(state, 5) == LUA_TNUMBER &&
-                lua_type(state, 6) == LUA_TNUMBER &&
-                lua_type(state, 7) == LUA_TNUMBER &&
-                lua_type(state, 8) == LUA_TNUMBER)
+            do
             {
-                // Get parameter 1 off the stack.
-                Game::ClearFlags param1 = (Game::ClearFlags)lua_enumFromString_GameClearFlags(luaL_checkstring(state, 2));
+                if ((lua_type(state, 1) == LUA_TUSERDATA) &&
+                    (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
+                    lua_type(state, 3) == LUA_TNUMBER &&
+                    lua_type(state, 4) == LUA_TNUMBER &&
+                    lua_type(state, 5) == LUA_TNUMBER &&
+                    lua_type(state, 6) == LUA_TNUMBER &&
+                    lua_type(state, 7) == LUA_TNUMBER &&
+                    lua_type(state, 8) == LUA_TNUMBER)
+                {
+                    // Get parameter 1 off the stack.
+                    Game::ClearFlags param1 = (Game::ClearFlags)lua_enumFromString_GameClearFlags(luaL_checkstring(state, 2));
 
-                // Get parameter 2 off the stack.
-                float param2 = (float)luaL_checknumber(state, 3);
+                    // Get parameter 2 off the stack.
+                    float param2 = (float)luaL_checknumber(state, 3);
 
-                // Get parameter 3 off the stack.
-                float param3 = (float)luaL_checknumber(state, 4);
+                    // Get parameter 3 off the stack.
+                    float param3 = (float)luaL_checknumber(state, 4);
 
-                // Get parameter 4 off the stack.
-                float param4 = (float)luaL_checknumber(state, 5);
+                    // Get parameter 4 off the stack.
+                    float param4 = (float)luaL_checknumber(state, 5);
 
-                // Get parameter 5 off the stack.
-                float param5 = (float)luaL_checknumber(state, 6);
+                    // Get parameter 5 off the stack.
+                    float param5 = (float)luaL_checknumber(state, 6);
 
-                // Get parameter 6 off the stack.
-                float param6 = (float)luaL_checknumber(state, 7);
+                    // Get parameter 6 off the stack.
+                    float param6 = (float)luaL_checknumber(state, 7);
 
-                // Get parameter 7 off the stack.
-                int param7 = (int)luaL_checkint(state, 8);
+                    // Get parameter 7 off the stack.
+                    int param7 = (int)luaL_checkint(state, 8);
 
-                Game* instance = getInstance(state);
-                instance->clear(param1, param2, param3, param4, param5, param6, param7);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Game_clear - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+                    Game* instance = getInstance(state);
+                    instance->clear(param1, param2, param3, param4, param5, param6, param7);
+                    
+                    return 0;
+                }
+            } while (0);
+
+            lua_pushstring(state, "lua_Game_clear - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -285,11 +286,9 @@ int lua_Game_displayKeyboard(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_displayKeyboard - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_displayKeyboard - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -319,11 +318,9 @@ int lua_Game_exit(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_exit - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_exit - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -353,11 +350,9 @@ int lua_Game_frame(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_frame - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_frame - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -388,18 +383,22 @@ int lua_Game_gamepadEvent(lua_State* state)
                 Gamepad::GamepadEvent param1 = (Gamepad::GamepadEvent)lua_enumFromString_GamepadGamepadEvent(luaL_checkstring(state, 2));
 
                 // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<Gamepad> param2 = ScriptUtil::getObjectPointer<Gamepad>(3, "Gamepad", false);
+                bool param2Valid;
+                ScriptUtil::LuaArray<Gamepad> param2 = ScriptUtil::getObjectPointer<Gamepad>(3, "Gamepad", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'Gamepad'.");
+                    lua_error(state);
+                }
 
                 Game* instance = getInstance(state);
                 instance->gamepadEvent(param1, param2);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_gamepadEvent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_gamepadEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -441,11 +440,9 @@ int lua_Game_gesturePinchEvent(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_gesturePinchEvent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_gesturePinchEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -487,11 +484,9 @@ int lua_Game_gestureSwipeEvent(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_gestureSwipeEvent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_gestureSwipeEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -529,11 +524,9 @@ int lua_Game_gestureTapEvent(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_gestureTapEvent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_gestureTapEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -575,11 +568,9 @@ int lua_Game_getAIController(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getAIController - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getAIController - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -617,11 +608,9 @@ int lua_Game_getAccelerometerValues(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getAccelerometerValues - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getAccelerometerValues - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -663,11 +652,9 @@ int lua_Game_getAnimationController(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getAnimationController - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getAnimationController - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -700,11 +687,9 @@ int lua_Game_getAspectRatio(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getAspectRatio - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getAspectRatio - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -746,11 +731,9 @@ int lua_Game_getAudioController(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getAudioController - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getAudioController - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -792,11 +775,9 @@ int lua_Game_getAudioListener(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getAudioListener - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getAudioListener - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -838,11 +819,9 @@ int lua_Game_getConfig(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getConfig - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getConfig - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -875,11 +854,9 @@ int lua_Game_getFrameRate(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getFrameRate - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getFrameRate - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -925,11 +902,9 @@ int lua_Game_getGamepad(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getGamepad - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getGamepad - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -962,11 +937,9 @@ int lua_Game_getGamepadCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getGamepadCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getGamepadCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -999,11 +972,9 @@ int lua_Game_getGamepadsConnected(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getGamepadsConnected - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getGamepadsConnected - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1036,11 +1007,9 @@ int lua_Game_getHeight(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getHeight - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getHeight - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1082,11 +1051,9 @@ int lua_Game_getPhysicsController(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getPhysicsController - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getPhysicsController - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1128,11 +1095,9 @@ int lua_Game_getScriptController(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getScriptController - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getScriptController - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1165,11 +1130,9 @@ int lua_Game_getState(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getState - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getState - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1211,11 +1174,9 @@ int lua_Game_getViewport(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getViewport - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getViewport - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1248,11 +1209,9 @@ int lua_Game_getWidth(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_getWidth - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_getWidth - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1285,11 +1244,9 @@ int lua_Game_hasMouse(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_hasMouse - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_hasMouse - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1322,11 +1279,9 @@ int lua_Game_isCursorVisible(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_isCursorVisible - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_isCursorVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1363,11 +1318,9 @@ int lua_Game_isGestureRegistered(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_isGestureRegistered - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_isGestureRegistered - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1404,11 +1357,9 @@ int lua_Game_isGestureSupported(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_isGestureSupported - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_isGestureSupported - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1441,11 +1392,9 @@ int lua_Game_isInitialized(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_isInitialized - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_isInitialized - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1478,11 +1427,9 @@ int lua_Game_isMouseCaptured(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_isMouseCaptured - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_isMouseCaptured - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1515,11 +1462,9 @@ int lua_Game_isMultiTouch(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_isMultiTouch - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_isMultiTouch - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1557,11 +1502,9 @@ int lua_Game_keyEvent(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_keyEvent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_keyEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1591,11 +1534,9 @@ int lua_Game_menuEvent(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_menuEvent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_menuEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1644,11 +1585,9 @@ int lua_Game_mouseEvent(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_mouseEvent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_mouseEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1678,11 +1617,9 @@ int lua_Game_pause(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_pause - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_pause - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1716,11 +1653,9 @@ int lua_Game_registerGesture(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_registerGesture - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_registerGesture - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1750,11 +1685,9 @@ int lua_Game_resume(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_resume - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_resume - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1787,11 +1720,9 @@ int lua_Game_run(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_run - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_run - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1829,11 +1760,9 @@ int lua_Game_schedule(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_schedule - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_schedule - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1867,11 +1796,9 @@ int lua_Game_setCursorVisible(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_setCursorVisible - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_setCursorVisible - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1905,11 +1832,9 @@ int lua_Game_setMouseCaptured(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_setMouseCaptured - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_setMouseCaptured - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1943,11 +1868,9 @@ int lua_Game_setMultiTouch(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_setMultiTouch - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_setMultiTouch - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -1974,18 +1897,22 @@ int lua_Game_setViewport(lua_State* state)
                 (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TNIL))
             {
                 // Get parameter 1 off the stack.
-                ScriptUtil::LuaArray<Rectangle> param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true);
+                bool param1Valid;
+                ScriptUtil::LuaArray<Rectangle> param1 = ScriptUtil::getObjectPointer<Rectangle>(2, "Rectangle", true, &param1Valid);
+                if (!param1Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 1 to type 'Rectangle'.");
+                    lua_error(state);
+                }
 
                 Game* instance = getInstance(state);
                 instance->setViewport(*param1);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_setViewport - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_setViewport - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -2138,11 +2065,9 @@ int lua_Game_static_setVsync(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_static_setVsync - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_static_setVsync - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -2188,11 +2113,9 @@ int lua_Game_touchEvent(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_touchEvent - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_touchEvent - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -2226,11 +2149,9 @@ int lua_Game_unregisterGesture(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Game_unregisterGesture - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Game_unregisterGesture - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

+ 43 - 61
gameplay/src/lua/lua_Gamepad.cpp

@@ -57,11 +57,9 @@ int lua_Gamepad_draw(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_draw - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_draw - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -94,11 +92,9 @@ int lua_Gamepad_getButtonCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_getButtonCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_getButtonCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -135,11 +131,9 @@ int lua_Gamepad_getButtonState(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_getButtonState - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_getButtonState - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -181,11 +175,9 @@ int lua_Gamepad_getForm(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_getForm - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_getForm - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -218,11 +210,9 @@ int lua_Gamepad_getId(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_getId - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_getId - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -253,18 +243,22 @@ int lua_Gamepad_getJoystickAxisValues(lua_State* state)
                 unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
 
                 // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<Vector2> param2 = ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false);
+                bool param2Valid;
+                ScriptUtil::LuaArray<Vector2> param2 = ScriptUtil::getObjectPointer<Vector2>(3, "Vector2", false, &param2Valid);
+                if (!param2Valid)
+                {
+                    lua_pushstring(state, "Failed to convert parameter 2 to type 'Vector2'.");
+                    lua_error(state);
+                }
 
                 Gamepad* instance = getInstance(state);
                 instance->getJoystickAxisValues(param1, param2);
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_getJoystickAxisValues - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_getJoystickAxisValues - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -301,11 +295,9 @@ int lua_Gamepad_getJoystickAxisX(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_getJoystickAxisX - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_getJoystickAxisX - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -342,11 +334,9 @@ int lua_Gamepad_getJoystickAxisY(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_getJoystickAxisY - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_getJoystickAxisY - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -379,11 +369,9 @@ int lua_Gamepad_getJoystickCount(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_getJoystickCount - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_getJoystickCount - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -420,11 +408,9 @@ int lua_Gamepad_isJoystickActive(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_isJoystickActive - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_isJoystickActive - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -457,11 +443,9 @@ int lua_Gamepad_isVirtual(lua_State* state)
 
                 return 1;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_isVirtual - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_isVirtual - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:
@@ -495,11 +479,9 @@ int lua_Gamepad_update(lua_State* state)
                 
                 return 0;
             }
-            else
-            {
-                lua_pushstring(state, "lua_Gamepad_update - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
+
+            lua_pushstring(state, "lua_Gamepad_update - Failed to match the given parameters to a valid function signature.");
+            lua_error(state);
             break;
         }
         default:

Некоторые файлы не были показаны из-за большого количества измененных файлов