[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Finalizers and Lua.org demo page
- From: Mikhail Zajcev <zajcev.m@...>
- Date: Sun, 23 Jul 2017 21:48:54 +0400
Egor wrote:
> The idea is to defer closing "Output" TEXTAREA by temporarily
> redirecting its text to file descriptor #3
Other idea is to modify demo.lua:
1. Load user script in separate environment:
local env = {}
setmetatable(env, {__index = _ENV})
T, E = load(T, "=input", "t", env)
instead of
T,E=loadstring(T,"=input")
2. Delete and collect user environment after running script (or failing to run):
env = nil
collectgarbage()
before line
write[[</TEXTAREA><P>]]