aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/clientscripting.cpp1
-rw-r--r--src/script/lua_api/l_storage.cpp11
2 files changed, 6 insertions, 6 deletions
diff --git a/src/script/clientscripting.cpp b/src/script/clientscripting.cpp
index c1e308012..ccdcb928d 100644
--- a/src/script/clientscripting.cpp
+++ b/src/script/clientscripting.cpp
@@ -58,4 +58,5 @@ void ClientScripting::InitializeModApi(lua_State *L, int top)
ModApiStorage::Initialize(L, top);
LuaItemStack::Register(L);
+ StorageRef::Register(L);
}
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;
}