JContainers icon indicating copy to clipboard operation
JContainers copied to clipboard

Weird crash related to Lua.

Open Osmosis-Wrench opened this issue 1 year ago • 0 comments

Hi! I'm the author Custom Skills Menu and I've recently gotten a crash report that indicates that something to do with my JContaienrs Lua script is causing this user to crash. I was wondering if you had any ideas what could be the cause of the crash?

Any idea's at all would be helpful, I'm totally stumped. I can't think of any reason this would work for most users but not some.

I've attached crashlogs and lua script below.

Crash_2022_7_5_1-6-28.txt

local jc = jrequire 'jc'

local msm = {}

    function msm.returnSkillTreeObject(collection)
    local ret = JMap.object()

    local function trim(s)
        -- from PiL2 20.4
        return (s:gsub("^%s*(.-)%s*$", "%1"))
    end

    for x = 1, #collection do
        local file = io.open(collection[x], "r")
        local content = file:read "*a"
        file:close()
       local t = JMap.object()
        --for k, v in string.gmatch(content, "(%w+) = (\"?%w+.?%w?\"?)") do
        for k, v in string.gmatch(content, "(%w+) =(.-\n)") do
            t[k] = v
            -- cleanup crap
            t[k] = string.gsub(t[k], "\n", "")
            t[k] = string.gsub(t[k], " \\ ", "")
            t[k] = string.gsub(t[k], "\"", "")
            t[k] = trim(t[k])
        end
        if t["Name"]and t["MSM_DoNotShow"] == nil then
            local r = JMap.object()
            r["Name"] = t["Name"]
            r["Description"] = t["Description"]
            r["Skydome"] = t["Skydome"]
            r["icon_loc"] = "data/interface/MetaSkillsMenu/" .. r["Name"] .. " " .. string.gsub(t["ShowMenuFile"], ".esp", ".dds")
            r["icon_exists"] = 0
            r["hidden"] = 0
            r["ShowMenuFile"] = t["ShowMenuFile"]
            r["ShowMenuForm"] = "__formData|"..t["ShowMenuFile"].."|"..t["ShowMenuId"] -- construct formdata record
            ret[collection[x]] = r
        end
    end
    return ret
end

return msm

Osmosis-Wrench avatar Jul 06 '22 06:07 Osmosis-Wrench