/lua-win32

Exposes functions from the Windows API to Lua

Primary LanguageC

The Lua win32 module exposes miscellaneous functions from the Windows API. If you are looking for other Windows APIs then please have a look into the winapi Lua module.

local win32 = require('win32')
win32.SetCodePage('utf-8') -- Sets the module encoding to UTF-8 which is the default
print(win32.GetCommandLineArguments()) -- Returns the current process arguments as strings

Lua win32 is covered by the MIT license.

The functions are the following:

  • GetLastError Returns the last error as an integer.
  • GetConsoleOutputCodePage Returns the console output code page as an integer.
  • GetCodePage Returns the win32 module code page as an integer. The module code page is used to decode and encode strings.
  • SetCodePage Sets the win32 module code page, default is UTF-8. The code page could be passed as an integer or one of the followed strings: "default", "console", "utf-8", "ansi", "oem", "symbol"
  • GetMessageFromSystem Returns the message associated to the specified error or to the last error
  • GetCommandLine Returns the command line as a string
  • GetCommandLineArguments Returns the command line arguments as a strings
  • SetWindowOwner Sets the window used in the ShellExecute, MessageBox, GetOpenFileName and GetSaveFileName functions
  • ShellExecute Performs an operation on the specified file, such ad "open" or "edit".
  • MessageBox Shows a message box with the specified text, title and type, default to OK. Returns the message box result. This method will block.
  • GetOpenFileName Shows the file selection dialog and returns the selected file name as string. If multiple selection is enabled then returns the selected path followed by the file names as strings. This method will block.
  • GetSaveFileName Shows the file selection dialog and returns the selected file name as string. This method will block.
  • WaitProcessId Waits for a process identifier to terminate
  • GetExitCodeProcess Returns a process identifier exit code
  • TerminateProcessId Terminates a process identifier
  • GetCurrentProcessId Returns the current process identifier

The field constants contains constant values.