Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Sorry for necroing a long dead post, but I'm having a similar error and I've looked at the documentation you've linked. When I try to have GMLive reload an object's Draw GUI event, i get

[GMLive][7/14/2026 3:11:58 PM][ERROR] Runtime error: [error] Script index must be a number, got `undefined` (undefined)


The error in question stems from this nested function:

function GUIMask() {     
live_auto_call     
static surf = undefined;          
static Mask = function() {         
    live_name = "GUIMask:Mask"         
        if (live_call()) return live_result;         
        if (not surface_exists(surf)) {             
            surf = surface_create(display_get_gui_width(), display_get_gui_height());         
    }                 
    surface_set_target(surf);         
    draw_clear_alpha(c_black, 0);         
    gpu_set_colorwriteenable(false, false, false, true);     
};     
static Content = function() {         
    live_name = "GUIMask:Content"         
        if (live_call()) return live_result;         
        gpu_set_colorwriteenable(true, true, true, false);     
};     
static Render = function() {         
    live_name = "GUIMask:Render"         
    if (live_call()) return live_result;         
    gpu_set_colorwriteenable(true, true, true, true);         
    surface_reset_target();         
    draw_surface(surf, 0, 0);     
    }; 
} 
GUIMask();

Any help would be appreciated. I'm using Game Maker LTS 2026.0.0.16 with Runtime v2026.0.0.23.

Hard to tell from that alone, but try removing the outer-most live_auto_call - we don’t have true closures so GMLive can’t re-create some of the behavior with static / Script.staticFunc().

That didn't seem to work. I have a "live_auto_call" at the beginning of the event that calls this function, but I'll admit I don't fully understand the nitty gritty of how GMLive works. Will it just not work with static functions? Or could this have something to do with calling a nested function? The code I'm trying to test is in the Draw GUI event, so the code I've shared isn't even directly relevant and shouldn't need to change at runtime, which is why I'm confused that it stops working only after reloading with GMLive.

IIRC the specific case that’s weird is

function scr_some() {
    live_auto_call;
    static counter = 0;
    static a = function() { counter += 1 }
}

and then doing scr_some.a()

If you can reproduce this in a blank project, please email me a copy and I’ll have a peek

If you don’t want to do anything, I guess you can move the code to a different (non-static) script, but I can’t tell you from the information so far whether that’s actually what’s happening.