Function group() gives error

weedIDs = group(95109)
this line gives me an error “Lua failure”. Logs:
{:lua_error, {:illegal_index, {:erl_func, #Function<3.62652274/2 in :luerl.encode/2>}, “id”}, {:luerl, {:tstruct, %{122 => {:table, {:array, 0, 10, nil, 10}, :em

My plan is to have multiple groups with the same name to execute code on each of them:

groupname = variable("Groupname")
groups = api({
    method = "GET",
    url = "/api/point_groups/"
})
weeds = {}

for _, group in pairs(groups) do
    if group.name == groupname then
        plantIDs = group(group)
        for _, p in pairs(plantIDs) do

            local plant = api({
                method = "GET",
                url = "/api/points/" .. p
            })
            local x = plant.x
            local y = plant.y
            local z = soil_height(x, y)
            local radius = plant.radius
            table.insert(weeds, {x = x, y = y, z = z, radius = radius})
        end
    end
end

Link to Farmbot Documentation

Hi @hnico21

I want to reproduce this issue which you are seeing but is all the Lua code there ?
Can you show us also how you setup the Variable(s) in the Sequence Editor ? ( e.g. screen capture )

Thanks for your response.
Group name is just text Variable with a fixed value.
I tried multiple variations, including using a fixed number as group ID instead of search for it by code.
Maybe that confuses.

turns out the variable group messed with function group() :sweat_smile:

– CASE CLOSED

1 Like