Procházet zdrojové kódy

Updated Bundle::getObjectId() to be consistent with other id getters.
Updated API docs and lua bindings.

setaylor před 13 roky
rodič
revize
430c002ca4

+ 1 - 1
gameplay/src/Bundle.cpp

@@ -1749,7 +1749,7 @@ unsigned int Bundle::getObjectCount() const
     return _referenceCount;
 }
 
-const char* Bundle::getObjectID(unsigned int index) const
+const char* Bundle::getObjectId(unsigned int index) const
 {
     GP_ASSERT(_references);
     return (index >= _referenceCount ? NULL : _references[index].id.c_str());

+ 1 - 1
gameplay/src/Bundle.h

@@ -95,7 +95,7 @@ public:
      * 
      * @return The ID of the object at the given index, or NULL if index is invalid.
      */
-    const char* getObjectID(unsigned int index) const;
+    const char* getObjectId(unsigned int index) const;
 
 private:
 

+ 2 - 2
gameplay/src/Font.cpp

@@ -89,14 +89,14 @@ Font* Font::create(const char* path, const char* id)
     {
         // Get the ID of the first object in the bundle (assume it's a Font).
         const char* id;
-        if ((id = bundle->getObjectID(0)) == NULL)
+        if ((id = bundle->getObjectId(0)) == NULL)
         {
             GP_ERROR("Failed to load font without explicit id; the first object in the font bundle has a null id.");
             return NULL;
         }
 
         // Load the font using the ID of the first object in the bundle.
-        font = bundle->loadFont(bundle->getObjectID(0));
+        font = bundle->loadFont(bundle->getObjectId(0));
     }
     else
     {

+ 1 - 1
gameplay/src/SceneLoader.cpp

@@ -420,7 +420,7 @@ void SceneLoader::applyNodeUrls(Scene* scene)
                         unsigned int matchCount = 0;
                         for (unsigned int k = 0; k < objectCount; ++k)
                         {
-                            const char* objid = tmpBundle->getObjectID(k);
+                            const char* objid = tmpBundle->getObjectId(k);
                             if (strstr(objid, id.c_str()) == objid)
                             {
                                 // This object ID matches (starts with).

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

@@ -20,7 +20,7 @@ void luaRegister_Bundle()
         {"addRef", lua_Bundle_addRef},
         {"contains", lua_Bundle_contains},
         {"getObjectCount", lua_Bundle_getObjectCount},
-        {"getObjectID", lua_Bundle_getObjectID},
+        {"getObjectId", lua_Bundle_getObjectId},
         {"getRefCount", lua_Bundle_getRefCount},
         {"loadFont", lua_Bundle_loadFont},
         {"loadMesh", lua_Bundle_loadMesh},
@@ -198,7 +198,7 @@ int lua_Bundle_getObjectCount(lua_State* state)
     return 0;
 }
 
-int lua_Bundle_getObjectID(lua_State* state)
+int lua_Bundle_getObjectId(lua_State* state)
 {
     // Get the number of parameters.
     int paramCount = lua_gettop(state);
@@ -215,7 +215,7 @@ int lua_Bundle_getObjectID(lua_State* state)
                 unsigned int param1 = (unsigned int)luaL_checkunsigned(state, 2);
 
                 Bundle* instance = getInstance(state);
-                const char* result = instance->getObjectID(param1);
+                const char* result = instance->getObjectId(param1);
 
                 // Push the return value onto the stack.
                 lua_pushstring(state, result);
@@ -224,7 +224,7 @@ int lua_Bundle_getObjectID(lua_State* state)
             }
             else
             {
-                lua_pushstring(state, "lua_Bundle_getObjectID - Failed to match the given parameters to a valid function signature.");
+                lua_pushstring(state, "lua_Bundle_getObjectId - Failed to match the given parameters to a valid function signature.");
                 lua_error(state);
             }
             break;

+ 1 - 1
gameplay/src/lua/lua_Bundle.h

@@ -9,7 +9,7 @@ int lua_Bundle__gc(lua_State* state);
 int lua_Bundle_addRef(lua_State* state);
 int lua_Bundle_contains(lua_State* state);
 int lua_Bundle_getObjectCount(lua_State* state);
-int lua_Bundle_getObjectID(lua_State* state);
+int lua_Bundle_getObjectId(lua_State* state);
 int lua_Bundle_getRefCount(lua_State* state);
 int lua_Bundle_loadFont(lua_State* state);
 int lua_Bundle_loadMesh(lua_State* state);

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

@@ -92,6 +92,7 @@ void luaRegister_Container()
         {"isContainer", lua_Container_isContainer},
         {"isEnabled", lua_Container_isEnabled},
         {"isScrollBarsAutoHide", lua_Container_isScrollBarsAutoHide},
+        {"isScrolling", lua_Container_isScrolling},
         {"release", lua_Container_release},
         {"removeControl", lua_Container_removeControl},
         {"removeScriptCallback", lua_Container_removeScriptCallback},
@@ -3013,6 +3014,43 @@ int lua_Container_isScrollBarsAutoHide(lua_State* state)
     return 0;
 }
 
+int lua_Container_isScrolling(lua_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))
+            {
+                Container* instance = getInstance(state);
+                bool result = instance->isScrolling();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Container_isScrolling - 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_Container_release(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -61,6 +61,7 @@ int lua_Container_insertControl(lua_State* state);
 int lua_Container_isContainer(lua_State* state);
 int lua_Container_isEnabled(lua_State* state);
 int lua_Container_isScrollBarsAutoHide(lua_State* state);
+int lua_Container_isScrolling(lua_State* state);
 int lua_Container_release(lua_State* state);
 int lua_Container_removeControl(lua_State* state);
 int lua_Container_removeScriptCallback(lua_State* state);

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

@@ -97,6 +97,7 @@ void luaRegister_Form()
         {"isContainer", lua_Form_isContainer},
         {"isEnabled", lua_Form_isEnabled},
         {"isScrollBarsAutoHide", lua_Form_isScrollBarsAutoHide},
+        {"isScrolling", lua_Form_isScrolling},
         {"release", lua_Form_release},
         {"removeControl", lua_Form_removeControl},
         {"removeScriptCallback", lua_Form_removeScriptCallback},
@@ -3101,6 +3102,43 @@ int lua_Form_isScrollBarsAutoHide(lua_State* state)
     return 0;
 }
 
+int lua_Form_isScrolling(lua_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))
+            {
+                Form* instance = getInstance(state);
+                bool result = instance->isScrolling();
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Form_isScrolling - 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_Form_release(lua_State* state)
 {
     // Get the number of parameters.

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

@@ -63,6 +63,7 @@ int lua_Form_insertControl(lua_State* state);
 int lua_Form_isContainer(lua_State* state);
 int lua_Form_isEnabled(lua_State* state);
 int lua_Form_isScrollBarsAutoHide(lua_State* state);
+int lua_Form_isScrolling(lua_State* state);
 int lua_Form_release(lua_State* state);
 int lua_Form_removeControl(lua_State* state);
 int lua_Form_removeScriptCallback(lua_State* state);

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

@@ -569,9 +569,9 @@ void luaRegister_lua_Global()
     {
         std::vector<std::string> scopePath;
         scopePath.push_back("Logger");
-        ScriptUtil::registerConstantString("INFO", "INFO", scopePath);
-        ScriptUtil::registerConstantString("WARN", "WARN", scopePath);
-        ScriptUtil::registerConstantString("ERROR", "ERROR", scopePath);
+        ScriptUtil::registerConstantString("LEVEL_INFO", "LEVEL_INFO", scopePath);
+        ScriptUtil::registerConstantString("LEVEL_WARN", "LEVEL_WARN", scopePath);
+        ScriptUtil::registerConstantString("LEVEL_ERROR", "LEVEL_ERROR", scopePath);
     }
 
     // Register enumeration Mesh::IndexFormat.

+ 195 - 195
gameplay/src/lua/lua_Logger.cpp

@@ -1,195 +1,195 @@
-#include "Base.h"
-#include "ScriptController.h"
-#include "lua_Logger.h"
-#include "Base.h"
-#include "Game.h"
-#include "Logger.h"
-#include "ScriptController.h"
-#include "lua_LoggerLevel.h"
-
-namespace gameplay
-{
-
-void luaRegister_Logger()
-{
-    const luaL_Reg* lua_members = NULL;
-    const luaL_Reg lua_statics[] = 
-    {
-        {"isEnabled", lua_Logger_static_isEnabled},
-        {"log", lua_Logger_static_log},
-        {"set", lua_Logger_static_set},
-        {"setEnabled", lua_Logger_static_setEnabled},
-        {NULL, NULL}
-    };
-    std::vector<std::string> scopePath;
-
-    ScriptUtil::registerClass("Logger", lua_members, NULL, NULL, lua_statics, scopePath);
-}
-
-static Logger* getInstance(lua_State* state)
-{
-    void* userdata = luaL_checkudata(state, 1, "Logger");
-    luaL_argcheck(state, userdata != NULL, 1, "'Logger' expected.");
-    return (Logger*)((ScriptUtil::LuaObject*)userdata)->instance;
-}
-
-int lua_Logger_static_isEnabled(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 1:
-        {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                Logger::Level param1 = (Logger::Level)lua_enumFromString_LoggerLevel(luaL_checkstring(state, 1));
-
-                bool result = Logger::isEnabled(param1);
-
-                // Push the return value onto the stack.
-                lua_pushboolean(state, result);
-
-                return 1;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Logger_static_isEnabled - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 1).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Logger_static_log(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                Logger::Level param1 = (Logger::Level)lua_enumFromString_LoggerLevel(luaL_checkstring(state, 1));
-
-                // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<const char> param2 = ScriptUtil::getString(2, false);
-
-                Logger::log(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Logger_static_log - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Logger_static_set(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
-                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
-            {
-                // Get parameter 1 off the stack.
-                Logger::Level param1 = (Logger::Level)lua_enumFromString_LoggerLevel(luaL_checkstring(state, 1));
-
-                // Get parameter 2 off the stack.
-                ScriptUtil::LuaArray<const char> param2 = ScriptUtil::getString(2, false);
-
-                Logger::set(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Logger_static_set - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-int lua_Logger_static_setEnabled(lua_State* state)
-{
-    // Get the number of parameters.
-    int paramCount = lua_gettop(state);
-
-    // Attempt to match the parameters to a valid binding.
-    switch (paramCount)
-    {
-        case 2:
-        {
-            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
-                lua_type(state, 2) == LUA_TBOOLEAN)
-            {
-                // Get parameter 1 off the stack.
-                Logger::Level param1 = (Logger::Level)lua_enumFromString_LoggerLevel(luaL_checkstring(state, 1));
-
-                // Get parameter 2 off the stack.
-                bool param2 = ScriptUtil::luaCheckBool(state, 2);
-
-                Logger::setEnabled(param1, param2);
-                
-                return 0;
-            }
-            else
-            {
-                lua_pushstring(state, "lua_Logger_static_setEnabled - Failed to match the given parameters to a valid function signature.");
-                lua_error(state);
-            }
-            break;
-        }
-        default:
-        {
-            lua_pushstring(state, "Invalid number of parameters (expected 2).");
-            lua_error(state);
-            break;
-        }
-    }
-    return 0;
-}
-
-}
+#include "Base.h"
+#include "ScriptController.h"
+#include "lua_Logger.h"
+#include "Logger.h"
+#include "Base.h"
+#include "Game.h"
+#include "ScriptController.h"
+#include "lua_LoggerLevel.h"
+
+namespace gameplay
+{
+
+void luaRegister_Logger()
+{
+    const luaL_Reg* lua_members = NULL;
+    const luaL_Reg lua_statics[] = 
+    {
+        {"isEnabled", lua_Logger_static_isEnabled},
+        {"log", lua_Logger_static_log},
+        {"set", lua_Logger_static_set},
+        {"setEnabled", lua_Logger_static_setEnabled},
+        {NULL, NULL}
+    };
+    std::vector<std::string> scopePath;
+
+    ScriptUtil::registerClass("Logger", lua_members, NULL, NULL, lua_statics, scopePath);
+}
+
+static Logger* getInstance(lua_State* state)
+{
+    void* userdata = luaL_checkudata(state, 1, "Logger");
+    luaL_argcheck(state, userdata != NULL, 1, "'Logger' expected.");
+    return (Logger*)((ScriptUtil::LuaObject*)userdata)->instance;
+}
+
+int lua_Logger_static_isEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 1:
+        {
+            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                Logger::Level param1 = (Logger::Level)lua_enumFromString_LoggerLevel(luaL_checkstring(state, 1));
+
+                bool result = Logger::isEnabled(param1);
+
+                // Push the return value onto the stack.
+                lua_pushboolean(state, result);
+
+                return 1;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Logger_static_isEnabled - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 1).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Logger_static_log(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                Logger::Level param1 = (Logger::Level)lua_enumFromString_LoggerLevel(luaL_checkstring(state, 1));
+
+                // Get parameter 2 off the stack.
+                ScriptUtil::LuaArray<const char> param2 = ScriptUtil::getString(2, false);
+
+                Logger::log(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Logger_static_log - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Logger_static_set(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
+                (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
+            {
+                // Get parameter 1 off the stack.
+                Logger::Level param1 = (Logger::Level)lua_enumFromString_LoggerLevel(luaL_checkstring(state, 1));
+
+                // Get parameter 2 off the stack.
+                ScriptUtil::LuaArray<const char> param2 = ScriptUtil::getString(2, false);
+
+                Logger::set(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Logger_static_set - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+int lua_Logger_static_setEnabled(lua_State* state)
+{
+    // Get the number of parameters.
+    int paramCount = lua_gettop(state);
+
+    // Attempt to match the parameters to a valid binding.
+    switch (paramCount)
+    {
+        case 2:
+        {
+            if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
+                lua_type(state, 2) == LUA_TBOOLEAN)
+            {
+                // Get parameter 1 off the stack.
+                Logger::Level param1 = (Logger::Level)lua_enumFromString_LoggerLevel(luaL_checkstring(state, 1));
+
+                // Get parameter 2 off the stack.
+                bool param2 = ScriptUtil::luaCheckBool(state, 2);
+
+                Logger::setEnabled(param1, param2);
+                
+                return 0;
+            }
+            else
+            {
+                lua_pushstring(state, "lua_Logger_static_setEnabled - Failed to match the given parameters to a valid function signature.");
+                lua_error(state);
+            }
+            break;
+        }
+        default:
+        {
+            lua_pushstring(state, "Invalid number of parameters (expected 2).");
+            lua_error(state);
+            break;
+        }
+    }
+    return 0;
+}
+
+}

+ 17 - 17
gameplay/src/lua/lua_Logger.h

@@ -1,17 +1,17 @@
-#ifndef LUA_LOGGER_H_
-#define LUA_LOGGER_H_
-
-namespace gameplay
-{
-
-// Lua bindings for Logger.
-int lua_Logger_static_isEnabled(lua_State* state);
-int lua_Logger_static_log(lua_State* state);
-int lua_Logger_static_set(lua_State* state);
-int lua_Logger_static_setEnabled(lua_State* state);
-
-void luaRegister_Logger();
-
-}
-
-#endif
+#ifndef LUA_LOGGER_H_
+#define LUA_LOGGER_H_
+
+namespace gameplay
+{
+
+// Lua bindings for Logger.
+int lua_Logger_static_isEnabled(lua_State* state);
+int lua_Logger_static_log(lua_State* state);
+int lua_Logger_static_set(lua_State* state);
+int lua_Logger_static_setEnabled(lua_State* state);
+
+void luaRegister_Logger();
+
+}
+
+#endif

+ 38 - 38
gameplay/src/lua/lua_LoggerLevel.cpp

@@ -1,38 +1,38 @@
-#include "Base.h"
-#include "lua_LoggerLevel.h"
-
-namespace gameplay
-{
-
-static const char* enumStringEmpty = "";
-
-static const char* luaEnumString_LoggerLevel_LEVEL_INFO = "LEVEL_INFO";
-static const char* luaEnumString_LoggerLevel_LEVEL_WARN = "LEVEL_WARN";
-static const char* luaEnumString_LoggerLevel_LEVEL_ERROR = "LEVEL_ERROR";
-
-Logger::Level lua_enumFromString_LoggerLevel(const char* s)
-{
-    if (strcmp(s, luaEnumString_LoggerLevel_LEVEL_INFO) == 0)
-        return Logger::LEVEL_INFO;
-    if (strcmp(s, luaEnumString_LoggerLevel_LEVEL_WARN) == 0)
-        return Logger::LEVEL_WARN;
-    if (strcmp(s, luaEnumString_LoggerLevel_LEVEL_ERROR) == 0)
-        return Logger::LEVEL_ERROR;
-    GP_ERROR("Invalid enumeration value '%s' for enumeration Logger::Level.", s);
-    return Logger::LEVEL_INFO;
-}
-
-const char* lua_stringFromEnum_LoggerLevel(Logger::Level e)
-{
-    if (e == Logger::LEVEL_INFO)
-        return luaEnumString_LoggerLevel_LEVEL_INFO;
-    if (e == Logger::LEVEL_WARN)
-        return luaEnumString_LoggerLevel_LEVEL_WARN;
-    if (e == Logger::LEVEL_ERROR)
-        return luaEnumString_LoggerLevel_LEVEL_ERROR;
-    GP_ERROR("Invalid enumeration value '%d' for enumeration Logger::Level.", e);
-    return enumStringEmpty;
-}
-
-}
-
+#include "Base.h"
+#include "lua_LoggerLevel.h"
+
+namespace gameplay
+{
+
+static const char* enumStringEmpty = "";
+
+static const char* luaEnumString_LoggerLevel_LEVEL_INFO = "LEVEL_INFO";
+static const char* luaEnumString_LoggerLevel_LEVEL_WARN = "LEVEL_WARN";
+static const char* luaEnumString_LoggerLevel_LEVEL_ERROR = "LEVEL_ERROR";
+
+Logger::Level lua_enumFromString_LoggerLevel(const char* s)
+{
+    if (strcmp(s, luaEnumString_LoggerLevel_LEVEL_INFO) == 0)
+        return Logger::LEVEL_INFO;
+    if (strcmp(s, luaEnumString_LoggerLevel_LEVEL_WARN) == 0)
+        return Logger::LEVEL_WARN;
+    if (strcmp(s, luaEnumString_LoggerLevel_LEVEL_ERROR) == 0)
+        return Logger::LEVEL_ERROR;
+    GP_ERROR("Invalid enumeration value '%s' for enumeration Logger::Level.", s);
+    return Logger::LEVEL_INFO;
+}
+
+const char* lua_stringFromEnum_LoggerLevel(Logger::Level e)
+{
+    if (e == Logger::LEVEL_INFO)
+        return luaEnumString_LoggerLevel_LEVEL_INFO;
+    if (e == Logger::LEVEL_WARN)
+        return luaEnumString_LoggerLevel_LEVEL_WARN;
+    if (e == Logger::LEVEL_ERROR)
+        return luaEnumString_LoggerLevel_LEVEL_ERROR;
+    GP_ERROR("Invalid enumeration value '%d' for enumeration Logger::Level.", e);
+    return enumStringEmpty;
+}
+
+}
+

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

@@ -1,15 +1,15 @@
-#ifndef LUA_LOGGERLEVEL_H_
-#define LUA_LOGGERLEVEL_H_
-
-#include "Logger.h"
-
-namespace gameplay
-{
-
-// Lua bindings for enum conversion functions for Logger::Level.
-Logger::Level lua_enumFromString_LoggerLevel(const char* s);
-const char* lua_stringFromEnum_LoggerLevel(Logger::Level e);
-
-}
-
-#endif
+#ifndef LUA_LOGGERLEVEL_H_
+#define LUA_LOGGERLEVEL_H_
+
+#include "Logger.h"
+
+namespace gameplay
+{
+
+// Lua bindings for enum conversion functions for Logger::Level.
+Logger::Level lua_enumFromString_LoggerLevel(const char* s);
+const char* lua_stringFromEnum_LoggerLevel(Logger::Level e);
+
+}
+
+#endif