RayquazaGX / swigraylib

SWIG bindings for raylib (to Lua, and hopefully to other languages)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Functions returning '_Bool' in C are wrapped by SWIG to become returning '_Bool *' but not 'boolean' in Lua

Rinkaa opened this issue · comments

raylib.i Line 25:

// Define bool as _Bool, to overcome `typedef enum { false, true } bool;` in raylib.h being unrecognized by SWIG
#ifndef bool
    #define __bool_true_false_are_defined   1
    #define false (_Bool)0
    #define true (_Bool)1
    #define bool _Bool
#endif

It's this that causing the trouble

-w- I forgot C99 already has builtin bool type...
Here is a solution(C99 and onwards):

#ifndef bool
    #define bool bool
#endif

raylib is written in C99 so it is safe to define so