aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-03-16 07:53:39 +0100
committerGitHub <noreply@github.com>2017-03-16 07:53:39 +0100
commiteb88e5dd4b181a90b382c036cf6c4f42e63e8cc2 (patch)
tree2ba995e0a2f15c0bc50212169f0b5af8addd3f86 /src/script/lua_api
parent46276414ed51d61dc29879ac85e861dc770d90da (diff)
downloadminetest-eb88e5dd4b181a90b382c036cf6c4f42e63e8cc2.tar.gz
minetest-eb88e5dd4b181a90b382c036cf6c4f42e63e8cc2.tar.bz2
minetest-eb88e5dd4b181a90b382c036cf6c4f42e63e8cc2.zip
Add ModStorageAPI to client side modding (#5396)
mod storage is located into user_path / client / mod_storage
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_storage.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/script/lua_api/l_storage.cpp b/src/script/lua_api/l_storage.cpp
index 42928255f..867ab9c8d 100644
--- a/src/script/lua_api/l_storage.cpp
+++ b/src/script/lua_api/l_storage.cpp
@@ -33,10 +33,9 @@ int ModApiStorage::l_get_mod_storage(lua_State *L)
std::string mod_name = lua_tostring(L, -1);
ModMetadata *store = new ModMetadata(mod_name);
- // For server side
- if (Server *server = getServer(L)) {
- store->load(server->getModStoragePath());
- server->registerModStorage(store);
+ if (IGameDef *gamedef = getGameDef(L)) {
+ store->load(gamedef->getModStoragePath());
+ gamedef->registerModStorage(store);
} else {
assert(false); // this should not happen
}
@@ -70,8 +69,8 @@ int StorageRef::gc_object(lua_State *L)
{
StorageRef *o = *(StorageRef **)(lua_touserdata(L, 1));
// Server side
- if (Server *server = getServer(L))
- server->unregisterModStorage(getobject(o)->getModName());
+ if (IGameDef *gamedef = getGameDef(L))
+ gamedef->unregisterModStorage(getobject(o)->getModName());
delete o;
return 0;
}