Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Using LOVE2D API
- function love.load()
- input={}
- curNum="wee"
- end
- function love.keypressed(key)
- if tonumber(key:sub(#key, #key)) then
- if curNum=="wee" then curNum=="" end
- curNum=curNum..tonumber(key:sub(#key, #key))
- elseif key=="return" and not curNum=="wee" then
- input[#input+1]=curNum
- curNum="wee"
- else
- local num=0
- for i, v in pairs(input) do
- num=num+v
- end
- num=num/#input
- print(num)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement