Fixed error and on cleared set canvasOffset correctly.

This commit is contained in:
u-train 2020-07-19 21:05:35 -04:00
parent c402087972
commit 3e509c10ec
2 changed files with 9 additions and 6 deletions

View File

@ -48,14 +48,16 @@ end)
--If the code fails, print it out.
textBox:on("keyDown", function(key)
if key == "KEY_RETURN" or key == "KEY_KP_ENTER" then
local _, errorMessage = pcall(loadstring(textBox.text))
if errorMessage then
_, errorMessage = pcall(loadstring("return "..textBox.text))
if errorMessage then
print("CONSOLE ERROR: "..errorMessage)
local success, valueReturned = pcall(loadstring(textBox.text))
if not success then
success, valueReturned = pcall(loadstring("return "..textBox.text))
if not success then
print("CONSOLE ERROR: "..valueReturned)
else
print(function2())
print(valueReturned or "Ran without error.")
end
else
print(valueReturned or "Ran without error.")
end
textBox.text = ""
end

View File

@ -80,6 +80,7 @@ local new = function(properties)
list = {}
viewScroll:destroyChildren()
interface.reload()
viewScroll.canvasOffset = vector2()
end
viewScroll:on("changed", function(changed)