[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Multiple luaL_loadfile()/lua_pcall() and persistance
- From: Laurent FAILLIE <l_faillie@...>
- Date: Mon, 23 Jul 2018 09:17:06 +0000 (UTC)
I'm on a tool that load then execute several Lua scripts so I have many call to luaL_loadfile()/lua_pcall() pairs. My question is about code persistence.
3 examples :
--- script1.lua ---
print "I'm doing very interesting stuffs"
--- script2.lua ---
print "even more interesting stuffs"
--- script3.lua ---
print "Yeah, I'm here"
print "I'm the most interesting one"
My assertions are the following :
1/ content of script1 is only one shot so it is collected and resource are freed
2/ toto() and tata() kept, ready to be called by other code.
3/ after loading/calling all those 3 script, in Lua's memory only toto() and tata() remain, and "external" prints get collected after execution.
Am I right ?