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

2023-07-01 11:58:00 -04: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)