Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[PLUGIN]Why does editing a script's source cause the studio to crash?

Asked by
ked2000 15
10 years ago
function import(script, args, line)
    if (#args < 1) then
        err(script, {"Not enough arguments"}, line);
    else
        if (#args == 1) then --Only one for now
            if (_G.Acen.Files[args[1]]) then
                local target = _G.Acen.Files[args[1]];
                local source = "";

                for i, v in pairs(target.Source) do
                    source = source..v;
                end

                script.Source = [[]]..source..[[]]..script.Source;
            else
                err(script, {"'"..args[1].."' does not exist"}, line);
            end
        end
    end
end

This snippet of code in my plugin causes the studio to crash every single time it edits the source. How can I avoid the studio crash but still have the function edit a script's source?

Any help is greatly appreciated.

Answer this question