Jump to content
RealModScene
Kef0

attempt to index a nil value (global 'Script')" } When running my script

Recommended Posts

When running my script, Aurora returns this error (I got it through the debug.log.last):

"LUA", "message": "LUAERROR> Game:\\User\\Scripts\\Utility\\TestScript\\main.lua:14: attempt to index a nil value (global 'Script')" }

this is the only part that has a "Script." :

function DoShowMenu(menu)

    local ret = {}
    local canceled = false
    local menuItem = {}
    
    if menu == nil then
        ret, menu, canceled, menuItem = Menu.ShowMainMenu()
    else
        ret, menu, canceled, menuItem = Menu.ShowMenu(menu)
    end
    
    if not canceled then
        if Menu.IsMainMenu(menu) and menu.SubMenu == nil then
            Script.SetStatus("Teste1")
        end
        
        if menuItem.SubMenu ~= nil then
            DoShowMenu(menuItem.SubMenu)
        elseif not Menu.IsMainMenu(menu) then
            HandleSelection(ret, menu.Parent.Data, menu)
        else
            Script.ShowMessageBox("ERROR", "Test", "OK")
        end
    end
end

I'm new to this stuff, but I can't see what's wrong here. Any help here is useful, I'm clueless.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...