[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: data input from keyboard
- From: "Peter Shook" <pshook@...>
- Date: Sun, 27 Apr 2003 13:18:32 -0400
Try the following:
$ cat test.lua
print'enter name:'
name = io.stdin:read'*l'
print('name',name)
print'enter age:'
age = io.stdin:read'*l'
print('age',age)
$ lua test.lua
enter name:
bill
name bill
enter age:
5
age 5
- Peter Shook
> Hi people,
> I'm trying to write a simple program in Lua, but it's getting hard for me
> to work with data input from keyboard. I've tryed to use de function
> "read()" but I always get the following message:
>
> ../lua-5.0/bin/lua: teste.lua:2: attempt to call global `readfrom' (a nil
> value)
> stack traceback:
> teste.lua:2: in main chunk
> [C]: ?