diff options
| -rw-r--r-- | plugins/MirLua/src/m_windows.cpp | 27 | ||||
| -rw-r--r-- | plugins/MirLua/src/mlua_module_loader.cpp | 1 | ||||
| -rw-r--r-- | plugins/MirLua/src/stdafx.h | 3 | 
3 files changed, 31 insertions, 0 deletions
| diff --git a/plugins/MirLua/src/m_windows.cpp b/plugins/MirLua/src/m_windows.cpp new file mode 100644 index 0000000000..82b3a40d9e --- /dev/null +++ b/plugins/MirLua/src/m_windows.cpp @@ -0,0 +1,27 @@ +#include "stdafx.h"
 +
 +static int lua_ShellExecute(lua_State *L)
 +{
 +	ptrT command(mir_utf8decodeT(lua_tostring(L, 1)));
 +	ptrT file(mir_utf8decodeT(lua_tostring(L, 2)));
 +	ptrT args(mir_utf8decodeT(lua_tostring(L, 3)));
 +	int flags = lua_tointeger(L, 4);
 +
 +	::ShellExecute(NULL, command, file, args, NULL, flags);
 +
 +	return 0;
 +}
 +
 +static luaL_Reg winApi[] =
 +{
 +	{ "ShellExecute", lua_ShellExecute },
 +
 +	{ NULL, NULL }
 +};
 +
 +LUAMOD_API int luaopen_m_windows(lua_State *L)
 +{
 +	luaL_newlib(L, winApi);
 +
 +	return 1;
 +}
 diff --git a/plugins/MirLua/src/mlua_module_loader.cpp b/plugins/MirLua/src/mlua_module_loader.cpp index 386b592831..bc195cc701 100644 --- a/plugins/MirLua/src/mlua_module_loader.cpp +++ b/plugins/MirLua/src/mlua_module_loader.cpp @@ -26,6 +26,7 @@ void CLuaModuleLoader::LoadModules()  	PreloadModule(MLUA_POPUP, luaopen_m_popup);	
  	PreloadModule(MLUA_TOPTOOLBAR, luaopen_m_toptoolbar);
  	PreloadModule(MLUA_VARIABLES, luaopen_m_variables);
 +	PreloadModule(MLUA_WINDOWS, luaopen_m_windows);
  }
  void CLuaModuleLoader::Load(lua_State *L)
 diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h index 6ceb174e11..2a292f03c6 100644 --- a/plugins/MirLua/src/stdafx.h +++ b/plugins/MirLua/src/stdafx.h @@ -88,6 +88,9 @@ LUAMOD_API int (luaopen_m_toptoolbar)(lua_State *L);  #define MLUA_VARIABLES	"m_variables"
  LUAMOD_API int (luaopen_m_variables)(lua_State *L);
 +#define MLUA_WINDOWS	"m_windows"
 +LUAMOD_API int (luaopen_m_windows)(lua_State *L);
 +
  int luaM_print(lua_State *L);
  int luaM_atpanic(lua_State *L);
 | 
