RosettaCodeData/Task/Runtime-evaluation-In-an-environment/Lua/runtime-evaluation-in-an-environment-1.lua

5 lines
186 B
Lua
Raw Permalink Normal View History

2013-04-10 23:57:08 -07:00
code = loadstring"return x^2" --this doesn't really need to be input, does it?
val1 = setfenv(code, {x = io.read() + 0})()
val2 = setfenv(code, {x = io.read() + 0})()
print(val2 - val1)