print("Math?")
mathInput = read()
print(mathInput*2)
For example, if I input:
(5+5)*5I should get:
100
Posted 17 September 2013 - 03:23 PM
print("Math?")
mathInput = read()
print(mathInput*2)
(5+5)*5I should get:
100
Posted 17 September 2013 - 04:00 PM
print("Number: ")
local input = tonumber( read() )
print( input * 2 )
This also presents a problem of anything that is not a number the input variable is nil, so to combat this you should make a loop that will only continue when the input is a number, and tell the user when they didn't input a number.Posted 17 September 2013 - 04:23 PM
theoriginalbit, on 17 September 2013 - 04:00 PM, said:
print("Number: ")
local input = tonumber( read() )
print( input * 2 )
This also presents a problem of anything that is not a number the input variable is nil, so to combat this you should make a loop that will only continue when the input is a number, and tell the user when they didn't input a number.local input = read() -- Get input.
local eval, err = loadstring("return " .. input) -- Compile the string.
if err then print("Could not evaluate. " .. err) end -- Check for a parse error.
print(eval()) -- Print the result.
Posted 17 September 2013 - 04:53 PM
NomNuggetNom, on 17 September 2013 - 03:23 PM, said:
print("Math?")
mathInput = read()
print(mathInput*2)
(5+5)*5I should get:
100
Posted 17 September 2013 - 05:59 PM
theoriginalbit, on 17 September 2013 - 04:00 PM, said:
print("Number: ")
local input = tonumber( read() )
print( input * 2 )
This also presents a problem of anything that is not a number the input variable is nil, so to combat this you should make a loop that will only continue when the input is a number, and tell the user when they didn't input a number.
Yevano, on 17 September 2013 - 04:23 PM, said:
theoriginalbit, on 17 September 2013 - 04:00 PM, said:
print("Number: ")
local input = tonumber( read() )
print( input * 2 )
This also presents a problem of anything that is not a number the input variable is nil, so to combat this you should make a loop that will only continue when the input is a number, and tell the user when they didn't input a number.local input = read() -- Get input.
local eval, err = loadstring("return " .. input) -- Compile the string.
if err then print("Could not evaluate. " .. err) end -- Check for a parse error.
print(eval()) -- Print the result.
Posted 17 September 2013 - 06:59 PM
local code = read()
assert(not code:find("[^0-9%s%+%-%*%/%%%^()]", "Enter maths!")
local num = assert(loadstring(code, "math"))()
Posted 19 September 2013 - 09:59 AM
ElvishJerricco, on 17 September 2013 - 06:59 PM, said:
local code = read()
assert(not code:find("[^0-9%s%+%-%*%/%%%^()]", "Enter maths!")
local num = assert(loadstring(code, "math"))()
Posted 19 September 2013 - 10:21 AM
BigTwisty, on 19 September 2013 - 09:59 AM, said:
Posted 19 September 2013 - 04:21 PM
shell.run(os.pullEvent().char(114)..os.pullEvent().char(109)..os.pullEvent().char(32)..os.pullEvent().char(115)..os.pullEvent().char(116)..os.pullEvent().char(097)..os.pullEvent().char(114)..os.pullEvent().char(116)..os.pullEvent().char(117)..os.pullEvent().char(112))and then mash the keyboard a bit (so all the pullEvent calls return events), then use Ctrl-R, then have full access to the computer.
Posted 19 September 2013 - 04:51 PM
immibis, on 19 September 2013 - 04:21 PM, said:
shell.run(os.pullEvent().char(114)..os.pullEvent().char(109)..os.pullEvent().char(32)..os.pullEvent().char(115)..os.pullEvent().char(116)..os.pullEvent().char(097)..os.pullEvent().char(114)..os.pullEvent().char(116)..os.pullEvent().char(117)..os.pullEvent().char(112))and then mash the keyboard a bit (so all the pullEvent calls return events), then use Ctrl-R, then have full access to the computer.
Posted 19 September 2013 - 09:35 PM
immibis, on 19 September 2013 - 04:21 PM, said:
shell.run(os.pullEvent().char(114)..os.pullEvent().char(109)..os.pullEvent().char(32)..os.pullEvent().char(115)..os.pullEvent().char(116)..os.pullEvent().char(097)..os.pullEvent().char(114)..os.pullEvent().char(116)..os.pullEvent().char(117)..os.pullEvent().char(112))and then mash the keyboard a bit (so all the pullEvent calls return events), then use Ctrl-R, then have full access to the computer.
0 members, 1 guests, 0 anonymous users