# Struct length operator

The length operator # applied on a Struct object returns the size in bytes of the struct in memory.

Notes

  • The length operator returns the same result as the Struct.size property.

Example

local c = require "c" -- Defines a RECT Struct local RECT = c.Struct("iiii", "left", "top", "right", "bottom") print("Size of RECT Struct is "..#RECT.." bytes")