Skip to content

Commit

Permalink
Allow named script function registration to prevent C++ name clashes
Browse files Browse the repository at this point in the history
  • Loading branch information
daid committed Apr 28, 2024
1 parent d700193 commit 19f0827
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/scriptInterfaceMagic.h
Original file line number Diff line number Diff line change
Expand Up @@ -701,4 +701,12 @@ template<class T> class scriptBindObject
} \
ScriptClassInfo scriptClassInfo ## F ( # F , "" , registerFunctionFunction ## F , NULL );

#define REGISTER_SCRIPT_FUNCTION_NAMED(F, NAME) \
static void registerFunctionFunction ## F (lua_State* L) { \
lua_pushvalue(L, -1); \
lua_pushcclosure(L, &F, 1); \
lua_setglobal(L, NAME ); \
} \
ScriptClassInfo scriptClassInfo ## F ( NAME , "" , registerFunctionFunction ## F , NULL );

#endif//SCRIPT_INTERFACE_MAGIC_H

2 comments on commit 19f0827

@daid-tinyci
Copy link

@daid-tinyci daid-tinyci bot commented on 19f0827 Apr 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TinyCI build failure:

[make -j 2] returned [2]:


[  1%] Built target glad

[ 17%] Built target box2d

[ 27%] Built target lua

[ 34%] Built target basisu-encoder

[ 80%] Built target opus

[ 80%] Generating glDebug.inl

-- GLAD header: /data/tinyci_build/daid/SeriousProton/libs/glad/glad/glad.h

-- GlDebug.inl output: /data/tinyci_build/daid/SeriousProton/_build_native/include/graphics/glDebug.inl

[ 81%] Building CXX object CMakeFiles/seriousproton_objects.dir/src/audio/sound.cpp.o

[ 81%] Building CXX object CMakeFiles/seriousproton_objects.dir/src/audio/source.cpp.o

[ 81%] Building CXX object CMakeFiles/seriousproton_objects.dir/src/audio/music.cpp.o

[ 82%] Building CXX object CMakeFiles/seriousproton_objects.dir/src/clipboard.cpp.o

[ 82%] Building CXX object CMakeFiles/seriousproton_objects.dir/src/collisionable.cpp.o

[ 82%] Building CXX object CMakeFiles/seriousproton_objects.dir/src/engine.cpp.o

[ 83%] Building CXX object CMakeFiles/seriousproton_objects.dir/src/event.cpp.o

[ 83%] Building CXX object CMakeFiles/seriousproton_objects.dir/src/graphics/font.cpp.o

[ 83%] Building CXX object CMakeFiles/seriousproton_objects.dir/src/graphics/freetypefont.cpp.o

/data/tinyci_build/daid/SeriousProton/src/graphics/freetypefont.cpp:8:10: fatal error: ft2build.h: No such file or directory

    8 | #include <ft2build.h>

      |          ^~~~~~~~~~~~

compilation terminated.

make[2]: *** [CMakeFiles/seriousproton_objects.dir/build.make:194: CMakeFiles/seriousproton_objects.dir/src/graphics/freetypefont.cpp.o] Error 1

make[2]: *** Waiting for unfinished jobs....

make[1]: *** [CMakeFiles/Makefile2:209: CMakeFiles/seriousproton_objects.dir/all] Error 2

make: *** [Makefile:136: all] Error 2

@daid-tinyci
Copy link

@daid-tinyci daid-tinyci bot commented on 19f0827 Apr 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TinyCI build failure:

[make -j 2] returned [2]:


[  1%] Built target glad

[ 17%] Built target box2d

[ 27%] Built target lua

[ 34%] Built target basisu-encoder

[ 80%] Built target opus

[ 80%] Generating glDebug.inl

-- GLAD header: /data/tinyci_build/daid/SeriousProton/libs/glad/glad/glad.h

-- GlDebug.inl output: /data/tinyci_build/daid/SeriousProton/_build_native/include/graphics/glDebug.inl

[ 80%] Building CXX object CMakeFiles/seriousproton_objects.dir/src/graphics/freetypefont.cpp.o

[ 81%] Building CXX object CMakeFiles/seriousproton_objects.dir/src/graphics/image.cpp.o

/data/tinyci_build/daid/SeriousProton/src/graphics/freetypefont.cpp:8:10: fatal error: ft2build.h: No such file or directory

    8 | #include <ft2build.h>

      |          ^~~~~~~~~~~~

compilation terminated.

make[2]: *** [CMakeFiles/seriousproton_objects.dir/build.make:194: CMakeFiles/seriousproton_objects.dir/src/graphics/freetypefont.cpp.o] Error 1

make[2]: *** Waiting for unfinished jobs....

make[1]: *** [CMakeFiles/Makefile2:209: CMakeFiles/seriousproton_objects.dir/all] Error 2

make: *** [Makefile:136: all] Error 2

Please sign in to comment.