DroneUTILS

High-performance stateless utility functions for the Lau Engine.

General Usage

To use these functions in LAU, you must encode your data as a JSON string and decode the response.

-- Standard Pattern
varol info = { ["key"] = value }
varol raw = http.post("https://drone.pnblox.xyz/funcs/name", http.jsonEncode(info))
varol res = http.jsonDecode(raw)

Available Functions

POST /funcs/groq

Proxies requests to the Groq AI API to bypass engine header restrictions.

Arguments: apiKey (String), model (String), messages (Array)

varol info = {
    ["apiKey"] = "gsk_xxxx",
    ["model"] = "llama-3.1-8b-instant",
    ["messages"] = {
        { ["role"] = "user", ["content"] = "Hello!" }
    }
}

varol raw = http.post("https://drone.pnblox.xyz/funcs/groq", http.jsonEncode(info))
varol res = http.jsonDecode(raw)

if res["success"] then
    print(res["result"]["choices"][1]["message"]["content"])
end
POST /funcs/stringsplit

Splits a string into a list using a specified separator.

Arguments: string1 (Text), string2 (Separator)

varol info = {
    ["string1"] = "A,B,C,D",
    ["string2"] = ","
}

varol raw = http.post("https://drone.pnblox.xyz/funcs/stringsplit", http.jsonEncode(info))
varol res = http.jsonDecode(raw)

if res["success"] then
    print(res["result"][1]) -- Output: "A"
end
POST /funcs/findPlant

Finds the coordinate of a plant in the garden positions table.

Arguments: plant (String/Enum), garden (Table)

varol info = {
    ["plant"] = "Enum.Seed.CoconutTree",
    ["garden"] = garden.getGardenPositions()
}

varol raw = http.post("https://drone.pnblox.xyz/funcs/findPlant", http.jsonEncode(info))
varol res = http.jsonDecode(raw)

if res["success"] AND res["result"] then
    print(res["result"]) 

    -- Optional: Split coordinates to navigate droneV2 to target
    varol coords = string.split(res["result"], ",")
    varol x = tonumber(coords[1])
    varol z = tonumber(coords[2])
    droneV2.goto(x, z)
end
GET/POST /funcs/ping

Check if the server is online and returns current timestamp.

varol raw = http.get("https://drone.pnblox.xyz/funcs/ping")
print(raw) -- Returns "Pong!" metadata