From b7fd3c86693bcb53f66c6b4b2d83248c534aa17b Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Tue, 28 Feb 2012 20:41:26 +0200 Subject: Add minetest.get_worldpath() for getting location for custom data --- src/scriptapi.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/scriptapi.cpp') diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index a064cd688..8350c75f1 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -3560,6 +3560,14 @@ static int l_get_modpath(lua_State *L) return 1; } +// get_worldpath() +static int l_get_worldpath(lua_State *L) +{ + std::string worldpath = get_server(L)->getWorldPath(); + lua_pushstring(L, worldpath.c_str()); + return 1; +} + static const struct luaL_Reg minetest_f [] = { {"debug", l_debug}, {"log", l_log}, @@ -3576,6 +3584,7 @@ static const struct luaL_Reg minetest_f [] = { {"get_hitting_properties", l_get_hitting_properties}, {"get_current_modname", l_get_current_modname}, {"get_modpath", l_get_modpath}, + {"get_worldpath", l_get_worldpath}, {NULL, NULL} }; -- cgit v1.2.3