Announcement

Collapse
No announcement yet.

Reproducible crash

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Reproducible crash

    Package lambda:
    Code:
    local menu = ImportPackage("iMenu")
    AddEvent("OnKeyPress", function(key)
        if key == "E" then
            menu.menuCreate({
                name = {
                    GetPackageName() .. "adminMenu"
                },
                options = {
                    align = "top-center",
                    title = "Mon super menu!"
                },
                elements = {
                    {
                        label = "Label",
                        type = "button",
                        color = "red",
                        classes = {"test"},
                        arguments = {"yay", "plop", "suuuuure!"}
                    }
                },
                onClose = function (menu)
                    AddPlayerChat(menu.options.align)
                end,
                onElementClicked = function(menu, element)
                    AddPlayerChat(element.label)
                end
            })
        end
    end)
    package iMenu:
    Code:
    function menuCreate(menuParameters)
        AddPlayerChat("Menu create ok ")
        -- if (GetWebVisibility(web) == WEB_VISIBLE) then
        --  SetWebVisibility(web, WEB_HIDDEN)
        --  SetInputMode(INPUT_GAME)
        --  ShowMouseCursor(false)
        -- else
        --  SetWebVisibility(web, WEB_VISIBLE)
        --  SetInputMode(INPUT_GAMEANDUI)
        --  ShowMouseCursor(true)
    
        --  table.insert(menus, menuParameters)
    
        --  ExecuteWebJS(web, "createMenu(`" .. json_encode({
        --      options = menuParameters.options,
        --      elements = menuParameters.elements
        --  }) .. "`)")
        -- end
    end
    AddFunctionExport("menuCreate", menuCreate)
    Dumps: https://drive.google.com/file/d/1rx6...ew?usp=sharing

    #2
    I suspect the function to not be interpreted as function...

    CONFIRMED:

    Code:
    local menu = ImportPackage("iMenu")
    AddEvent("OnKeyPress", function(key)
        if key == "E" then
            menu.menuCreate({
                name = {
                    GetPackageName() .. "adminMenu"
                },
                options = {
                    align = "top-center",
                    title = "Mon super menu!"
                },
                elements = {
                    {
                        label = "Label",
                        type = "button",
                        color = "red",
                        classes = {"test"},
                        arguments = {"yay", "plop", "suuuuure!"}
                    }
                },
                -- onClose = function (menu)
                --  AddPlayerChat(menu.options.align)
                -- end,
                -- onElementClicked = function(menu, element)
                --  AddPlayerChat(element.label)
                -- end
            })
        end
    end)
    This is working as expected.

    Comment


      #3
      Thanks for the report. This is related to https://forum.playonset.com/forum/on...ecurity-breach
      Unfortunately, it's just not possible to pass functions between Lua States.
      For this scenario I'd suggest to call an event with the menu identifier as argument.

      Comment

      Working...
      X