Add counter safety to lvera #11

Open
opened 2024-12-12 14:16:38 +00:00 by andnull · 0 comments
Owner

Currently counter just trust the user not to mess up. Should probably add opt-in safety checks. However, there could be something interesting here:

self.port(counters)
if type(counters["@ret #1"]) ~= "number" 
or not is_positive_integer(counters["@ret #1"]) then
    self.state["@ret #1"] = counters["@ret #1"]
    counters["@ret #1"] = counters["@ret #1"] and 1 or 0
end

This would let you do something like

counters["@ret #1"] = false
Currently counter just trust the user not to mess up. Should probably add opt-in safety checks. However, there could be something interesting here: ```lua self.port(counters) if type(counters["@ret #1"]) ~= "number" or not is_positive_integer(counters["@ret #1"]) then self.state["@ret #1"] = counters["@ret #1"] counters["@ret #1"] = counters["@ret #1"] and 1 or 0 end ``` This would let you do something like ``` counters["@ret #1"] = false ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
vera/lvera#11
No description provided.