wplua: split the functionality of the load functions into smaller functions
The load functions used to do 3 things: - push the sandbox function on the stack - load the file and push it as a function on the stack - call the sandbox (or the file) Now there are separate functions to do these 3: - wplua_push_sandbox - wplua_load_* - wplua_pcall
This commit is contained in:
@@ -40,11 +40,17 @@ static gboolean
|
||||
execute_script (lua_State *L, struct ScriptData * s, GError ** error)
|
||||
{
|
||||
int nargs = 0;
|
||||
nargs += wplua_push_sandbox (L);
|
||||
|
||||
if (!wplua_load_path (L, s->filename, error)) {
|
||||
lua_pop (L, nargs);
|
||||
return FALSE;
|
||||
}
|
||||
if (s->args) {
|
||||
wplua_gvariant_to_lua (L, s->args);
|
||||
nargs++;
|
||||
}
|
||||
return wplua_load_path (L, s->filename, nargs, 0, error);
|
||||
return wplua_pcall (L, nargs, 0, error);
|
||||
}
|
||||
|
||||
G_DECLARE_FINAL_TYPE (WpLuaScriptingPlugin, wp_lua_scripting_plugin,
|
||||
|
Reference in New Issue
Block a user