Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.4 KiB

  1. /* -----------------------------------------------------------------------------
  2. * See the LICENSE file for information on copyright, usage and redistribution
  3. * of SWIG, and the README file for authors - http://www.swig.org/release.html.
  4. *
  5. * luaruntime.swg
  6. *
  7. * all the runtime code for .
  8. * ----------------------------------------------------------------------------- */
  9. %runtime "swigrun.swg"; /* Common C API type-checking code */
  10. %runtime "luarun.swg"; /* Lua runtime stuff */
  11. %insert(initbeforefunc) "swiginit.swg"
  12. %insert(initbeforefunc) %{
  13. /* Forward declaration of where the user's %init{} gets inserted */
  14. void SWIG_init_user(lua_State* L );
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. /* this is the initialization function
  19. added at the very end of the code
  20. the function is always called SWIG_init, but an eariler #define will rename it
  21. */
  22. SWIGEXPORT int SWIG_init(lua_State* L)
  23. {
  24. int i;
  25. /* start with global table */
  26. lua_pushvalue(L,LUA_GLOBALSINDEX);
  27. /* SWIG's internal initalisation */
  28. SWIG_InitializeModule((void*)L);
  29. SWIG_PropagateClientData();
  30. /* add a global fn */
  31. SWIG_Lua_add_function(L,"swig_type",SWIG_Lua_type);
  32. SWIG_Lua_add_function(L,"swig_equals",SWIG_Lua_equal);
  33. /* begin the module (its a table with the same name as the module) */
  34. SWIG_Lua_module_begin(L,SWIG_name);
  35. /* add commands/functions */
  36. for (i = 0; swig_commands[i].name; i++){
  37. SWIG_Lua_module_add_function(L,swig_commands[i].name,swig_commands[i].func);
  38. }
  39. /* add variables */
  40. for (i = 0; swig_variables[i].name; i++){
  41. SWIG_Lua_module_add_variable(L,swig_variables[i].name,swig_variables[i].get,swig_variables[i].set);
  42. }
  43. /* set up base class pointers (the hierachy) */
  44. for (i = 0; swig_types[i]; i++){
  45. if (swig_types[i]->clientdata){
  46. SWIG_Lua_init_base_class(L,(swig_lua_class*)(swig_types[i]->clientdata));
  47. }
  48. }
  49. /* additional registration structs & classes in lua */
  50. for (i = 0; swig_types[i]; i++){
  51. if (swig_types[i]->clientdata){
  52. SWIG_Lua_class_register(L,(swig_lua_class*)(swig_types[i]->clientdata));
  53. }
  54. }
  55. /* constants */
  56. SWIG_Lua_InstallConstants(L,swig_constants);
  57. /* invoke user-specific initialization */
  58. SWIG_init_user(L);
  59. /* end module */
  60. lua_pop(L,1); /* tidy stack (remove module table)*/
  61. lua_pop(L,1); /* tidy stack (remove global table)*/
  62. return 1;
  63. }
  64. #ifdef __cplusplus
  65. }
  66. #endif
  67. %}
  68. /* Note: the initialization function is closed after all code is generated */