Murga-Projects Forums
User Prompt - Printable Version

+- Murga-Projects Forums (
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: User Prompt (/showthread.php?tid=292)

User Prompt - asafp - 02-27-2008 08:04 AM

Does anyone know how to prompt a user for input from a console application? Ideally, it would be able to mask the input for a password type field.

RE: User Prompt - mikshaw - 02-27-2008 08:34 AM


As a simple example, open up lua interactively.
type ""; it will wait for input.
type something else.
type "print(var)"; it will print whatever you typed previously.

I'm not sure about masking, but I'd be surprised if it's not available.

RE: User Prompt - iGame3D - 02-29-2008 08:34 AM

That is so basic. You think this would be step 2 after hello world.

--[[ lua command line user user input

o = the print() function
p = a prompt to the user
r = response from the computer
i =  i returns input waiting until line feed to continue execution
This example is all one line of code.

o ,p ,r = print, "Enter your name.","Hello "; o(p);; if i then o(r..i) end;

I had no  idea how to interactively give values to programs running in the command line until now. I'm sure its been in our telnet chat script forever and I totally overlooked it.


RE: User Prompt - mikshaw - 03-01-2008 06:59 AM

There is an interesting example of a text-based menu at lua-users: (AsciiMenu)

RE: User Prompt - asafp - 03-05-2008 03:34 PM

Good examples. Thanx.