Murga-Projects Forums
Segmentation Fault w/browser or text_editor - Printable Version

+- Murga-Projects Forums (http://www.murga-projects.com/forum)
+-- Forum: Project Forums (/forumdisplay.php?fid=1)
+--- Forum: MurgaLua - General (/forumdisplay.php?fid=2)
+--- Thread: Segmentation Fault w/browser or text_editor (/showthread.php?tid=285)


Segmentation Fault w/browser or text_editor - iGame3D - 02-15-2008 04:34 PM

I also get Bus Errors, but that maybe have been fixed.
I'll attach the docs and crash logs.

This is basically Tobi's original code, and it works in the console and script editor,
but I can't make it work here, it was sent by the level1Clicked function below.

Code:
function fillRawData(...)
    local str=""
    local i=1
    while arg[i]~= nil do
        if str=="" then
            str=tostring(arg[i])
        else
            str=str.."    "..tostring(arg[i])
        end
        i=i+1
    end
    local l_offset=#rawData_buf:text()
    rawData:insert_position(l_offset)
    rawData:insert(str.."\n")
    rawData:show_insert_position()
    rawData:textfont(4)
    rawData:textsize(10)
    
end


It segfaults all the time. So I tried several hacks, all bad, this latest:

Code:
function level1Clicked(w)
if w:value()>0 then    
    rawData:clear()
    rawData_buf:text("")
    
-- a number index to func name and docs data
funN=documentation.found[w:value()]

    if funN ~= nil then
    -- a string from the table
    docs=documentation.doc[funN]
        if docs ~= nil then  rawData:insert(docs.."\n") end
    end
end
end  -- level1Clicked


Works the first click, second click = Segfault

Any clues?