Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal

3XC4L1B3R

Members
  • Content Count

    2
  • Joined

  • Last visited

Everything posted by 3XC4L1B3R

  1. I made a function that can check if a number should be rounded up or down, and returns the rounded number. It's pretty simple, but I wanted to share. function round(n) if n >= math.floor(n)+0.5 then n = math.ceil(n) else n = math.floor(n) end return n end for i = 1,10 do local r = math.random(1,99) / 10 print(r.." rounds to "..round(r)) end And I included a random number generator, if you want to test it.
  2. I've been trying to make a simple password reader, but it just doesn't work... Whenever I enter anything into the field, another character will be added (in the form of an extra line break if pwchar is nil). At first, I thought the "dobreak" parameter would help, but all that does is print "incorrect" on the same line as the password... local term = require("term") local pw term.write("enter password: ") pw = (term.read(nil, false, nil, "*")) if pw == "1234" then print("correct") else print("incorrect") end I've also tried other importing other peoples' password reade
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.