Update Lua instances (2/4)

This is effectively a NO-OP.
This commit is contained in:
Robin Gareus 2023-10-04 01:25:04 +02:00
parent 7c10a54334
commit 6b3f25eb2a
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
4 changed files with 8 additions and 15 deletions

View File

@ -51,7 +51,7 @@ LuaProc::LuaProc (AudioEngine& engine,
#ifdef USE_TLSF #ifdef USE_TLSF
, lua (lua_newstate (&PBD::TLSF::lalloc, &_mempool)) , lua (lua_newstate (&PBD::TLSF::lalloc, &_mempool))
#elif defined USE_MALLOC #elif defined USE_MALLOC
, lua () , lua (true, true)
#else #else
, lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool)) , lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool))
#endif #endif
@ -87,7 +87,7 @@ LuaProc::LuaProc (const LuaProc &other)
#ifdef USE_TLSF #ifdef USE_TLSF
, lua (lua_newstate (&PBD::TLSF::lalloc, &_mempool)) , lua (lua_newstate (&PBD::TLSF::lalloc, &_mempool))
#elif defined USE_MALLOC #elif defined USE_MALLOC
, lua () , lua (true, true)
#else #else
, lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool)) , lua (lua_newstate (&PBD::ReallocPool::lalloc, &_mempool))
#endif #endif
@ -176,8 +176,6 @@ LuaProc::init ()
luabridge::push <LuaProc *> (L, this); luabridge::push <LuaProc *> (L, this);
lua_setglobal (L, "self"); lua_setglobal (L, "self");
// sandbox
lua.sandbox (true);
#if 0 #if 0
lua.do_command ("for n in pairs(_G) do print(n) end print ('----')"); // print global env lua.do_command ("for n in pairs(_G) do print(n) end print ('----')"); // print global env
#endif #endif

View File

@ -184,7 +184,7 @@ LuaScripting::lua_print (std::string s) {
LuaScriptInfoPtr LuaScriptInfoPtr
LuaScripting::scan_script (const std::string &fn, const std::string &sc) LuaScripting::scan_script (const std::string &fn, const std::string &sc)
{ {
LuaState lua; LuaState lua (true, true);
if (!(fn.empty() ^ sc.empty())){ if (!(fn.empty() ^ sc.empty())){
// give either file OR script // give either file OR script
assert (0); assert (0);
@ -193,7 +193,6 @@ LuaScripting::scan_script (const std::string &fn, const std::string &sc)
lua_State* L = lua.getState(); lua_State* L = lua.getState();
lua.Print.connect (&LuaScripting::lua_print); lua.Print.connect (&LuaScripting::lua_print);
lua.sandbox (true);
lua.do_command ( lua.do_command (
"ardourluainfo = {}" "ardourluainfo = {}"
@ -392,7 +391,7 @@ LuaScriptParams::script_params (const LuaScriptInfoPtr& lsi, const std::string &
LuaScriptParamList LuaScriptParamList
LuaScriptParams::script_params (const std::string& s, const std::string &pname, bool file) LuaScriptParams::script_params (const std::string& s, const std::string &pname, bool file)
{ {
LuaState lua; LuaState lua (true, true);
return LuaScriptParams::script_params (lua, s, pname, file); return LuaScriptParams::script_params (lua, s, pname, file);
} }
@ -402,7 +401,6 @@ LuaScriptParams::script_params (LuaState& lua, const std::string& s, const std::
LuaScriptParamList rv; LuaScriptParamList rv;
lua_State* L = lua.getState(); lua_State* L = lua.getState();
lua.sandbox (true);
lua.do_command ("function ardour () end"); lua.do_command ("function ardour () end");
try { try {
@ -481,9 +479,8 @@ LuaScripting::try_compile (const std::string& script, const LuaScriptParamList&
if (bytecode.empty()) { if (bytecode.empty()) {
return false; return false;
} }
LuaState l; LuaState l (true, true);
l.Print.connect (&LuaScripting::lua_print); l.Print.connect (&LuaScripting::lua_print);
l.sandbox (true);
lua_State* L = l.getState(); lua_State* L = l.getState();
l.do_command ("" l.do_command (""
@ -520,9 +517,8 @@ LuaScripting::try_compile (const std::string& script, const LuaScriptParamList&
std::string std::string
LuaScripting::get_factory_bytecode (const std::string& script, const std::string& ffn, const std::string& fp) LuaScripting::get_factory_bytecode (const std::string& script, const std::string& ffn, const std::string& fp)
{ {
LuaState l; LuaState l (true, true);
l.Print.connect (&LuaScripting::lua_print); l.Print.connect (&LuaScripting::lua_print);
l.sandbox (true);
lua_State* L = l.getState(); lua_State* L = l.getState();
l.do_command ( l.do_command (

View File

@ -5309,7 +5309,6 @@ void
Session::setup_lua () Session::setup_lua ()
{ {
lua.Print.connect (&_lua_print); lua.Print.connect (&_lua_print);
lua.sandbox (true);
lua.do_command ( lua.do_command (
"function ArdourSession ()" "function ArdourSession ()"
" local self = { scripts = {}, instances = {} }" " local self = { scripts = {}, instances = {} }"

View File

@ -416,7 +416,7 @@ setup_lua ()
{ {
assert (!lua); assert (!lua);
lua = new LuaState (); lua = new LuaState (false, false);
lua->Print.connect (&my_lua_print); lua->Print.connect (&my_lua_print);
lua_State* L = lua->getState (); lua_State* L = lua->getState ();
@ -491,7 +491,7 @@ interactive_interpreter ()
} }
do { do {
LuaState lt; LuaState lt (false, false);
lua_State* L = lt.getState (); lua_State* L = lt.getState ();
int status = luaL_loadbuffer (L, line, strlen (line), "=stdin"); int status = luaL_loadbuffer (L, line, strlen (line), "=stdin");
if (!incomplete (L, status)) { if (!incomplete (L, status)) {