LCOV - code coverage report
Current view: top level - src - api.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 11 0
Test Date: 2026-04-03 02:26:39 Functions: 0.0 % 2 0

            Line data    Source code
       1              : #ifndef _API_H_
       2              : #define _API_H_
       3              : 
       4              : #define luaL_setfuncs krig_custom_setfuncs
       5              : 
       6              : 
       7              : extern "C" {
       8              :   #include "luajit-2.1/lua.h"
       9              :   #include "luajit-2.1/lualib.h"
      10              :   #include "luajit-2.1/lauxlib.h"
      11              : }
      12              : 
      13              : #if !defined LUA_VERSION_NUM || LUA_VERSION_NUM==501
      14              : /*
      15              :  * Adapted from Lua 5.2.0
      16              :  */
      17            0 : inline void krig_custom_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
      18            0 :    luaL_checkstack(L, nup+1, "too many upvalues");
      19            0 :    for (; l->name != NULL; l++) {  /* fill the table with given functions */
      20              :      int i;
      21            0 :      lua_pushstring(L, l->name);
      22            0 :      for (i = 0; i < nup; i++)  /* copy upvalues to the top */
      23            0 :        lua_pushvalue(L, -(nup+1));
      24            0 :      lua_pushcclosure(L, l->func, nup);  /* closure with those upvalues */
      25            0 :      lua_settable(L, -(nup + 3));
      26            0 :    }
      27            0 :    lua_pop(L, nup);  /* remove upvalues */
      28            0 : }
      29              : #endif
      30              : 
      31              : #include "krig_game_engine.h"
      32              : #include "Object.h"
      33              : 
      34              : // Macros /////////////////////////////////////////////////////////////////////
      35              : #define SCRIPT_CALLBACK_ON_LOAD        "on_load"
      36              : #define SCRIPT_CALLBACK_ON_UPDATE      "on_update"
      37              : #define SCRIPT_CALLBACK_ON_DRAW        "on_draw"
      38              : #define SCRIPT_CALLBACK_ON_DRAW_SCREEN "on_draw_screen"
      39              : #define SCRIPT_CALLBACK_ON_COLLISION   "on_collision"
      40              : #define SCRIPT_CALLBACK_ON_UNLOAD      "on_unload"
      41              : 
      42              : // Functions /////// ///////////////////////////////////////////////////////////
      43              : Vector loadVector(lua_State *L);
      44              : Vector loadVector(lua_State *L, int &index);
      45              : Quaternion loadQuaternion(lua_State *L, const int &index);
      46              : Object* loadObject(lua_State *L, const int &index);
      47              : void loadArray(lua_State *L, float array[], int len, int index);
      48              : void returnVector(lua_State *L, const Vector &t);
      49              : void returnQuaternion(lua_State *L, const Quaternion &t);
      50              : void returnObject(lua_State *L, Object* object);
      51              : void returnArray(lua_State *L, float array[], int len);
      52              : void luaopen_krigApi(lua_State *L);
      53              : 
      54              : #endif
        

Generated by: LCOV version 2.4-0