summaryrefslogtreecommitdiff
path: root/src/scriptapi.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-04-01 10:08:52 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-04-01 12:38:14 +0300
commit56ba193c77109687b9115be0ccb1730922caef65 (patch)
tree02532fd24d82c80c61c2e5fc689656c4b5cca9b9 /src/scriptapi.cpp
parentd5594e431c841bf6a4c97bac946ef188404df129 (diff)
downloadminetest-56ba193c77109687b9115be0ccb1730922caef65.tar.gz
minetest-56ba193c77109687b9115be0ccb1730922caef65.tar.bz2
minetest-56ba193c77109687b9115be0ccb1730922caef65.zip
Allow getting the path of builtin.lua using minetest.get_modpath("__builtin")
Diffstat (limited to 'src/scriptapi.cpp')
-rw-r--r--src/scriptapi.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp
index a86c56f9c..ac5142209 100644
--- a/src/scriptapi.cpp
+++ b/src/scriptapi.cpp
@@ -3928,8 +3928,13 @@ static int l_get_current_modname(lua_State *L)
// get_modpath(modname)
static int l_get_modpath(lua_State *L)
{
- const char *modname = luaL_checkstring(L, 1);
+ std::string modname = luaL_checkstring(L, 1);
// Do it
+ if(modname == "__builtin"){
+ std::string path = get_server(L)->getBuiltinLuaPath();
+ lua_pushstring(L, path.c_str());
+ return 1;
+ }
const ModSpec *mod = get_server(L)->getModSpec(modname);
if(!mod){
lua_pushnil(L);