Small coroutine fix

This commit is contained in:
Robert Jelic
2025-04-06 06:51:43 +02:00
parent a307f58dfb
commit 0a597e63f1
5 changed files with 18 additions and 12 deletions

View File

@@ -6,7 +6,7 @@ local split = require("libraries/utils").split
---@configDescription The container class. It is a visual element that can contain other elements. It is the base class for all containers
---@configDefault true
--- The Container class serves as a fundamental building block for organizing UI elements. It acts as a parent element that can hold and manage child elements, providing layout management, event propagation, and rendering capabilities. Used as base class for Frames, Windows, and other container-like elements.
--- The Container class serves as a fundamental building block for organizing UI elements. It acts as a parent element that can hold and manage child elements.
--- @usage local container = basalt.getMainFrame()
--- @usage container:addButton() -- Add a child element
---@class Container : VisualElement

View File

@@ -55,6 +55,7 @@ end
--- @param bgCol number The background color of the series
--- @param fgCol number The foreground color of the series
--- @param pointCount number The number of points in the series
--- @return Graph self The graph instance
function Graph:addSeries(name, symbol, bgCol, fgCol, pointCount)
local series = self.get("series")
table.insert(series, {

View File

@@ -238,13 +238,15 @@ local function updateEvent(event, ...)
end
for _, func in ipairs(basalt._schedule) do
if(event==func.filter)or(func.filter==nil)then
local ok, result = coroutine.resume(func.coroutine, event, ...)
if(not ok)then
errorManager.header = "Basalt Schedule Error"
errorManager.error(result)
if(coroutine.status(func.coroutine)=="suspended")then
if(event==func.filter)or(func.filter==nil)then
local ok, result = coroutine.resume(func.coroutine, event, ...)
if(not ok)then
errorManager.header = "Basalt Schedule Error"
errorManager.error(result)
end
func.filter = result
end
func.filter = result
end
if(coroutine.status(func.coroutine)=="dead")then
basalt.removeSchedule(func.coroutine)

View File

@@ -39,9 +39,6 @@ end
---@splitClass
--- This is the benchmark plugin. It provides performance measurement tools for elements and methods,
--- with support for hierarchical profiling and detailed statistics.
--- The following methods are available for BaseElement
---@class BaseElement
local BaseElement = {}
@@ -298,8 +295,10 @@ function Container:stopContainerBenchmark(methodName)
return self
end
--- Benchmark API methods
---@class BenchmarkAPI
--- This is the benchmark plugin. It provides performance measurement tools for elements and methods,
--- with support for hierarchical profiling and detailed statistics. The plugin is meant to be used for very big projects
--- where performance is critical. It allows you to measure the time taken by specific methods and log the results.
---@class Benchmark
local API = {}
--- Starts a custom benchmark

View File

@@ -195,6 +195,10 @@ end)
--- This module provides reactive functionality for elements, it adds no new functionality for elements.
--- It is used to evaluate expressions in property values and update the element when the expression changes.
--- @usage local button = main:addButton({text="Exit"})
--- @usage button:setX("{parent.x - 12}")
--- @usage button:setBackground("{self.clicked and colors.red or colors.green}")
--- @usage button:setWidth("{self.text:len() + 2}")
---@class Reactive
local BaseElement = {}