Lua to C conversion rules

These conversion rules apply when using/writing Lua values to C types :

  • Getting arrays indexed value or struct/union fields
  • Reading external variables
  • Retrieving return values from C calls
C type Lua type
signed char, int, long, long long, int16_t, int32_t, int64_t number
unsigned char, int, long, long long, uint16_t, uint32_t, uint64_t, size_t
doublefloat number
bool boolean
C pointer Pointer
struct Struct
union Union
C array [ ] Array