diff options
author | Alex Auvolat <alex@adnab.me> | 2017-01-14 10:49:28 +0100 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2017-01-14 10:49:28 +0100 |
commit | 809d660944cfb515e18bb7f1c1519392b4bccd53 (patch) | |
tree | 6ca443116167b5911daad27550bb0a9a1dd0bce6 /src/syslua/test.lua | |
parent | c451e6d95b4d0a7ce27fcd97bc94fd3540649b73 (diff) | |
download | kogata-809d660944cfb515e18bb7f1c1519392b4bccd53.tar.gz kogata-809d660944cfb515e18bb7f1c1519392b4bccd53.zip |
More Lua works
Diffstat (limited to 'src/syslua/test.lua')
-rw-r--r-- | src/syslua/test.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/syslua/test.lua b/src/syslua/test.lua new file mode 100644 index 0000000..67b2852 --- /dev/null +++ b/src/syslua/test.lua @@ -0,0 +1,19 @@ +print("Hello, world! (printed)") + + +return function(n) + local a = math.random(n) + while true do + io.stdout:write("Guess? ") + local x = tonumber(io.stdin:read()) + if x < a then + print("Too small!") + elseif x > a then + print("Too big!") + else + print("Bingo!") + break + end + end +end + |