// 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);
}
// Path to builtin.lua
- std::string builtinpath = porting::path_share + DIR_DELIM + "builtin"
- + DIR_DELIM + "builtin.lua";
+ std::string builtinpath = getBuiltinLuaPath() + DIR_DELIM + "builtin.lua";
// Create world if it doesn't exist
if(!initializeWorld(m_path_world, m_gamespec.id))
}
return NULL;
}
+std::string Server::getBuiltinLuaPath()
+{
+ return porting::path_share + DIR_DELIM + "builtin";
+}
v3f findSpawnPos(ServerMap &map)
{
IWritableCraftDefManager* getWritableCraftDefManager();
const ModSpec* getModSpec(const std::string &modname);
+ std::string getBuiltinLuaPath();
std::string getWorldPath(){ return m_path_world; }