List of curve Lua functions in FarmBot OS
Gets a curve object by its ID which can then be used to get the curve value for a given day, usually based on a plant’s current age. Properties of the curve object include:
name- The curve’s name
type- The curve’s type (
unit- The curve’s unit (
mLfor water curves or
mmfor spread and height curves)
day(number)- The curve’s value for the given day, eg:
Manually find a curve’s ID by navigating to the curve in the web app and copying the number at the end of the URL.
-- Get curve by its ID curve = get_curve(123) -- Display curve value and units for day 10 day = 10 toast("The " .. curve.type .. " on day " .. day .. " is " .. curve.day(day) .. curve.unit)
A plant’s curve IDs can be retrieved from the
height_curve_id properties of the plant object.
-- Get plant from sequence variable local plant = variable("Plant") if plant.water_curve_id then -- Get water curve from plant local water_curve = get_curve(plant.water_curve_id) -- Get water amount in mL from curve for the plant's current age local water_ml = water_curve.day(plant.age) -- Display how much to water the plant today local days_old = " (" .. plant.age .. " days old)" toast(plant.name .. days_old .. " should be watered " .. water_ml .. "mL") else toast("Plant has no assigned water curve.", "warn") end