RosettaCodeData/Task/Runtime-evaluation-In-an-environment/Lua/runtime-evaluation-in-an-environment-1.lua
2015-02-20 00:35:01 -05:00

4 lines
186 B
Lua

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)