Overview
@nodiscard marks a function whose return value callers should use. If you call the function and ignore the return value, GLuaLS reports discard-returns.
Syntax
Usage
With a custom message
Add a string to explain why the return value matters:When to use
Use@nodiscard on functions where:
- Ignoring the return value is usually a bug, such as getting a handle or a result you must check
- Callers must manage work tied to the return value, such as cleanup or cancellation
- Functions returning an
Entitythat the caller is expected to configure - Functions returning a success boolean
- Token or handle-returning functions