]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/script/lua_api/l_storage.cpp
Revert "Make Lint Happy"
[dragonfireclient.git] / src / script / lua_api / l_storage.cpp
index fe3b4d74c95f8f6feb40aff0803b97404b2adb0c..cba34fb631c673f24f723c0e90d9703b4451bb7c 100644 (file)
@@ -53,7 +53,8 @@ void ModApiStorage::Initialize(lua_State *L, int top)
        API_FCT(get_mod_storage);
 }
 
-StorageRef::StorageRef(ModMetadata *object) : m_object(object)
+StorageRef::StorageRef(ModMetadata *object):
+       m_object(object)
 {
 }
 
@@ -89,7 +90,7 @@ void StorageRef::Register(lua_State *L)
 
        lua_pushliteral(L, "__metatable");
        lua_pushvalue(L, methodtable);
-       lua_settable(L, metatable); // hide metatable from Lua getmetatable()
+       lua_settable(L, metatable);  // hide metatable from Lua getmetatable()
 
        lua_pushliteral(L, "metadata_class");
        lua_pushlstring(L, className, strlen(className));
@@ -107,28 +108,27 @@ void StorageRef::Register(lua_State *L)
        lua_pushcfunction(L, l_equals);
        lua_settable(L, metatable);
 
-       lua_pop(L, 1); // drop metatable
+       lua_pop(L, 1);  // drop metatable
 
-       luaL_openlib(L, 0, methods, 0); // fill methodtable
-       lua_pop(L, 1);                  // drop methodtable
+       luaL_openlib(L, 0, methods, 0);  // fill methodtable
+       lua_pop(L, 1);  // drop methodtable
 }
 
-StorageRef *StorageRef::checkobject(lua_State *L, int narg)
+StorageRefStorageRef::checkobject(lua_State *L, int narg)
 {
        luaL_checktype(L, narg, LUA_TUSERDATA);
        void *ud = luaL_checkudata(L, narg, className);
-       if (!ud)
-               luaL_typerror(L, narg, className);
-       return *(StorageRef **)ud; // unbox pointer
+       if (!ud) luaL_typerror(L, narg, className);
+       return *(StorageRef**)ud;  // unbox pointer
 }
 
-ModMetadata *StorageRef::getobject(StorageRef *ref)
+ModMetadataStorageRef::getobject(StorageRef *ref)
 {
        ModMetadata *co = ref->m_object;
        return co;
 }
 
-Metadata *StorageRef::getmeta(bool auto_create)
+MetadataStorageRef::getmeta(bool auto_create)
 {
        return m_object;
 }
@@ -139,10 +139,17 @@ void StorageRef::clearMeta()
 }
 
 const char StorageRef::className[] = "StorageRef";
-const luaL_Reg StorageRef::methods[] = {luamethod(MetaDataRef, contains),
-               luamethod(MetaDataRef, get), luamethod(MetaDataRef, get_string),
-               luamethod(MetaDataRef, set_string), luamethod(MetaDataRef, get_int),
-               luamethod(MetaDataRef, set_int), luamethod(MetaDataRef, get_float),
-               luamethod(MetaDataRef, set_float), luamethod(MetaDataRef, to_table),
-               luamethod(MetaDataRef, from_table), luamethod(MetaDataRef, equals),
-               {0, 0}};
+const luaL_Reg StorageRef::methods[] = {
+       luamethod(MetaDataRef, contains),
+       luamethod(MetaDataRef, get),
+       luamethod(MetaDataRef, get_string),
+       luamethod(MetaDataRef, set_string),
+       luamethod(MetaDataRef, get_int),
+       luamethod(MetaDataRef, set_int),
+       luamethod(MetaDataRef, get_float),
+       luamethod(MetaDataRef, set_float),
+       luamethod(MetaDataRef, to_table),
+       luamethod(MetaDataRef, from_table),
+       luamethod(MetaDataRef, equals),
+       {0,0}
+};