lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


2011/1/5 luciano de souza <luchyanus@gmail.com>:
> Hi all,
>
> I wrote a code intended to be executed in windows and ubuntu. and I
> used IUP as a graphical library. I am blind and with IUP, I can create
> simple graphical interfaces compatible with screen readers.
>
> Since screen readers works differently in Windows and Linux, I need to
> insert a code regarding the running operational system.
>
> if {command to identify windows} == true then
> {commands applied to Windows system}
> else
> {command applied to Linux system}
> end
>
> I imagined I would get it with a command like "os.getenv('system') ==
> 'windows'", but there is no a environment variable called 'system'.
>
> What do you suggest?

There is an "OS" environment variable on recent Windows, which content
is "Windows_NT". That's what I use when I need to do platform-specific
stuff.

if os.getenv('OS')=='Windows_NT' then
  {commands applied to Windows system}
else
  {command applied to Linux system}
end