1

I'm trying to read and detect all #define preprocessors in a C header file (glew.h) so I can convert them to Lua global variables.

For example, #define GL_RGB 0x1908 will be detected and run as the following code so it can be registered as a global variable in Lua.

lua_pushnumber(L, 0x1908);
lua_setglobal(L, "GL_RGB"); 

Is this a good idea? Or would it be too slow to process the header file whenever the app starts?

All I want is to be able to use all the #definesin Lua.

Zack Lee
  • 2,784
  • 6
  • 35
  • 77

0 Answers0