1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

Detect math error in hangman & use consistent/clear error messaging

This commit is contained in:
Frédéric Thomas 2008-08-09 15:36:11 +00:00
parent db2c6ed4d9
commit 0fa7dda2cb
2 changed files with 10 additions and 2 deletions

View File

@ -1,10 +1,18 @@
-- Hangman in eLua using the 'term' module
-- Inspired by the original 'hangman' from the bsdgames package
-- we need a random function
-- using math.random for now, which implies target=lua, not lualong
if not math then
print "\nError: Hangman needs the math module (disabled when target=lualong) !\n"
return
end
local h, w = term.lines(), term.cols()
local tries = 0
-- "Databse" with our words
-- "Database" with our words
local words = { "simple", "hangman", "guess", "elua", "inane", "serial",
"stupenduous", "software" }

View File

@ -7,7 +7,7 @@ elseif pd.platform() == "LM3S" then
elseif pd.platform() == "STR9" then
ledpin = pio.P9_0
else
print( "Unknown platform " .. pd.platform() )
print( "\nError: Unknown platform " .. pd.platform() .. " !\n" )
return
end