fix: uuid.lua -- daw_register gets nil, error() usage, style #29

Closed
opened 2026-05-25 19:29:26 +02:00 by michael · 2 comments
Owner

Problems

  1. Critical: daw_register(_NAME, M) called but M is never defined.
    Module table is named uuid, not M. Registration passes nil.

  2. error() in read_random_bytes instead of nil, err.
    Violates DAW error handling standard.

  3. io.open("/dev/urandom") used directly.

  4. is_version_4 is redundant -- validate already enforces v4 pattern.
    Can be removed or kept as thin wrapper around validate.

  5. Indentation is 4 spaces -- rest of daw-lua-common uses 2 spaces.

  6. Header minimal -- no usage example, no refs.

## Problems 1. Critical: `daw_register(_NAME, M)` called but M is never defined. Module table is named `uuid`, not `M`. Registration passes nil. 2. `error()` in `read_random_bytes` instead of nil, err. Violates DAW error handling standard. 3. `io.open("/dev/urandom")` used directly. 4. `is_version_4` is redundant -- `validate` already enforces v4 pattern. Can be removed or kept as thin wrapper around validate. 5. Indentation is 4 spaces -- rest of daw-lua-common uses 2 spaces. 6. Header minimal -- no usage example, no refs.
Author
Owner

Fix: rename internal table from 'uuid' to 'M' for consistency with all other daw.common modules. Then 'return M' and 'daw_register(_NAME, M)' are both correct.

Fix: rename internal table from 'uuid' to 'M' for consistency with all other daw.common modules. Then 'return M' and 'daw_register(_NAME, M)' are both correct.
Author
Owner

daw_register(_NAME, M) fixed (was registering an undefined 'uuid' variable -- module never registered correctly). error() replaced with nil,err at the point of failure via fs.handle.open_read/read_bytes (new). Local table renamed to M for repo convention. Covered in test_uuid.lua.

daw_register(_NAME, M) fixed (was registering an undefined 'uuid' variable -- module never registered correctly). error() replaced with nil,err at the point of failure via fs.handle.open_read/read_bytes (new). Local table renamed to M for repo convention. Covered in test_uuid.lua.
michael 2026-07-19 17:55:13 +02:00
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
DAW/daw-lua-common#29
No description provided.