Skip to content

table.sort function gives "Failed to perform mandatory yield" near end of time slice #48

@canny

Description

@canny

Builder's Brewery [Main] Mesh Academy Blender Classroom, Builders Brewery (77, 62, 26)

LUAU 2026-01-30.21516666911

If the scan range is decreased to 10 giving fewer sensor results the script works, when number of sensor results increases the error occurs..

The objective is to sort a table of uuid's by the corresponding object names.


function LLEvents.touch_start(total_number)

    ll.Say(0, "touch_start")

    ll.Sensor("", NULL_KEY, PASSIVE+AGENT , 30.0, PI)

end

function LLEvents.sensor( events )

    ll.Say(0, "sensor")

    local lSensorResults = {}

    for _, evt in events do

         table.insert(lSensorResults, evt:getKey() )

    end

    -- now sort and print

    table.sort(lSensorResults, function(a,b) return string.lower( ll.Key2Name(a)) < string.lower( ll.Key2Name(b)) end )

    for i, kn in ipairs(lSensorResults) do

        ll.Say(0,`{ll.Key2Name(kn)} {kn}`)

    end

end

https://secondlife.canny.io/admin/board/slua-alpha/p/tablesort-function-gives-failed-to-perform-mandatory-yield-near-end-of-time-slic

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions