View Full Version : get text from command line?
ianhull
07-08-2008, 08:35 AM
hi all, how would I get the text from the commandline?
Heres how to do it in C, but I need to do it in lua.
thanks
strncpy(szText, lpCmdLine, MAX_CHARS - 1);
RizlaUK
07-08-2008, 08:51 AM
there is a default variable that defines the commandline arguments
_CommandLineArgs
A numerically indexed table that contains the command line arguments passed into the AutoPlay application.
example usage
if _CommandLineArgs then
local CountArgs=Table.Count(_CommandLineArgs)
Dialog.Message("CommandLineArgs", CountArgs.." arguments were passed to the exe);
end
ianhull
07-08-2008, 08:59 AM
Thanks Riz, I have never worked with commandline before and I am a little confused.
Have you seen my post in the dev den? I really need to get the same functionality in Lua.
if you could have a look and let me know your thoughts it would be greatly appreciated.
thanks
Imagine Programming
07-08-2008, 09:31 AM
if _CommandLineArgs then
if _CommandLineArgs[1] then
Dialog.Message("Test", "Argument one:\r\n".._CommandLineArgs[1])
end
--andsoforth
end
or
if _CommandLineArgs then
for i, ArgString in _CommandLineArgs do
ListBox.AddItem("ListBoxObject", ArgString, "Data");
end
end
:)
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.