William Adams wrote: > I want to be able to access the thing easily > I want the access to be as fast as possible > I want to avoid collisions with constants that might be defined elsewhere. local ffi = require("ffi") ffi.cdef[[ struct whatever { static const int FOO = 42; static const int BAR = 99; }; ]] local W = ffi.new("struct whatever") print(W.FOO, W.BAR) Yes, these are compiled to actual constants, just like enum constants (and unlike Lua table fields). Except that enum constants are global in C, even if defined inside a struct. Note that it's slightly more efficient to use an instance of the dummy struct (W) as a namespace than using the ctype. In many actual use cases you already have a struct to deal with. Then it's quite natural to define the related constants there, too. --Mike