Main Menu: Add get_clientmodpath API (#5912)
Add `core.get_clientmodpath` to main menu API (also possible in async calls).
This commit is contained in:
parent
b3dfe5332c
commit
fee5171298
@ -35,6 +35,8 @@ core.get_builtin_path()
|
|||||||
^ returns path to builtin root
|
^ returns path to builtin root
|
||||||
core.get_modpath() (possible in async calls)
|
core.get_modpath() (possible in async calls)
|
||||||
^ returns path to global modpath
|
^ returns path to global modpath
|
||||||
|
core.get_clientmodpath() (possible in async calls)
|
||||||
|
^ returns path to global client-side modpath
|
||||||
core.get_modstore_details(modid) (possible in async calls)
|
core.get_modstore_details(modid) (possible in async calls)
|
||||||
^ modid numeric id of mod in modstore
|
^ modid numeric id of mod in modstore
|
||||||
^ returns {
|
^ returns {
|
||||||
@ -234,7 +236,7 @@ Limitations of Async operations
|
|||||||
-Limited set of available functions
|
-Limited set of available functions
|
||||||
e.g. No access to functions modifying menu like core.start,core.close,
|
e.g. No access to functions modifying menu like core.start,core.close,
|
||||||
core.file_open_dialog
|
core.file_open_dialog
|
||||||
|
|
||||||
|
|
||||||
Class reference
|
Class reference
|
||||||
----------------
|
----------------
|
||||||
|
@ -734,6 +734,15 @@ int ModApiMainMenu::l_get_modpath(lua_State *L)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
int ModApiMainMenu::l_get_clientmodpath(lua_State *L)
|
||||||
|
{
|
||||||
|
std::string modpath = fs::RemoveRelativePathComponents(
|
||||||
|
porting::path_user + DIR_DELIM + "clientmods" + DIR_DELIM);
|
||||||
|
lua_pushstring(L, modpath.c_str());
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
int ModApiMainMenu::l_get_gamepath(lua_State *L)
|
int ModApiMainMenu::l_get_gamepath(lua_State *L)
|
||||||
{
|
{
|
||||||
@ -1120,6 +1129,7 @@ void ModApiMainMenu::Initialize(lua_State *L, int top)
|
|||||||
API_FCT(set_topleft_text);
|
API_FCT(set_topleft_text);
|
||||||
API_FCT(get_mapgen_names);
|
API_FCT(get_mapgen_names);
|
||||||
API_FCT(get_modpath);
|
API_FCT(get_modpath);
|
||||||
|
API_FCT(get_clientmodpath);
|
||||||
API_FCT(get_gamepath);
|
API_FCT(get_gamepath);
|
||||||
API_FCT(get_texturepath);
|
API_FCT(get_texturepath);
|
||||||
API_FCT(get_texturepath_share);
|
API_FCT(get_texturepath_share);
|
||||||
@ -1150,6 +1160,7 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
|
|||||||
API_FCT(get_favorites);
|
API_FCT(get_favorites);
|
||||||
API_FCT(get_mapgen_names);
|
API_FCT(get_mapgen_names);
|
||||||
API_FCT(get_modpath);
|
API_FCT(get_modpath);
|
||||||
|
API_FCT(get_clientmodpath);
|
||||||
API_FCT(get_gamepath);
|
API_FCT(get_gamepath);
|
||||||
API_FCT(get_texturepath);
|
API_FCT(get_texturepath);
|
||||||
API_FCT(get_texturepath_share);
|
API_FCT(get_texturepath_share);
|
||||||
@ -1162,4 +1173,3 @@ void ModApiMainMenu::InitializeAsync(lua_State *L, int top)
|
|||||||
API_FCT(get_modstore_list);
|
API_FCT(get_modstore_list);
|
||||||
//API_FCT(gettext); (gettext lib isn't threadsafe)
|
//API_FCT(gettext); (gettext lib isn't threadsafe)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +108,8 @@ private:
|
|||||||
|
|
||||||
static int l_get_modpath(lua_State *L);
|
static int l_get_modpath(lua_State *L);
|
||||||
|
|
||||||
|
static int l_get_clientmodpath(lua_State *L);
|
||||||
|
|
||||||
static int l_get_gamepath(lua_State *L);
|
static int l_get_gamepath(lua_State *L);
|
||||||
|
|
||||||
static int l_get_texturepath(lua_State *L);
|
static int l_get_texturepath(lua_State *L);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user