[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to detect a MSWindows console in pure Lua
- From: Lorenzo Donati <lorenzodonatibz@...>
- Date: Tue, 02 Nov 2010 10:50:33 +0100
steve donovan wrote:
I know, the Windows API is full of headaches. But another way to work
the system is using our friend io.popen and parsing the output from
system commands. For instance, dir /B *. gives all the directories
within the current directory, in a convenient bare format. And I
recently discovered the WMI command line tool:
C;\> wmic process get name,handle
actually does something very similar to the Unix ps.
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/wmic.mspx?mfr=true
There's also commands like netstat available.
Very interesting (didn't know wmic - have to try it and see what it offers)!
But is it not the parsing of console programs output a bit too brittle?
I use a localized (Italian) WinXP and all the commandline tools are
localized, so their output is full of codepage specific chars (eg. èéì).
Lua could choke on them (even if not UNICODE, they are not ASCII either,
and Lua patterns maybe don't react well to them - I remember having had
problems with upper/lowercase variants).
Ah! By the way, I had problem with Alien since it requires luarocks for
installation
It's part of the base LfW install. I've never compiled it for
Windows, would depend on what your toolchain is.
I use TDM mingw driven by (mostly handcrafted and probably ugly)
makefiles. I never programmed C/C++ from the command line since turbo C
in early 90s. When I programmed in C++ was always in a managed
environment (VC6) and did essentially math and data processing algos (no
fancy pointer things - mostly templates and high level OO stuff) so I'm
not a big fan of makefiles - I wish there could be a better tool, but I
acknowledge it is standard, so (sigh!) ... .
I struggled for years with standard mingw (never got it working
reliably), so I gave up until I read of TDM distro on SciTE group. It
works very well and the installation is smooth. I still struggle with
all those compiler options and the UNIX-like plethora of small programs
and their interaction (but that's my mindset's fault - I know! :-).
Nevertheless stock Lua compiles well and even some libraries (eg. srlua,
cinvoke, and some others).
Is there some reason why 'cinvoke' is rarely mentioned on this list and all
the focus is on 'Alien'? Are there some limitations or problems with it?
I don't know, Alien is more fully featured and developed.
Oh, I see.
Thanks for all the infos - need really time to ponder! :-)
--Lor