Last active
May 23, 2016 08:30
-
-
Save billyquith/2c5dff02d174604266dfc99d7493f1e0 to your computer and use it in GitHub Desktop.
Useful Lua C API debug macros
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Put at start of function | |
#define LUDB_DECL int db_top(0),zz_ltop=lua_gettop(L),db_d_top(0),db_typei(-1),db_idx(0); \ | |
const char *db_type(0), *db_valstr(0); | |
// Put after each line Lua API was used | |
#define LUDB(I) db_top=lua_gettop(L); db_d_top=db_top-zz_ltop; zz_ltop=db_top; \ | |
db_typei=lua_type(L,I); db_type=lua_typename(L,db_typei); \ | |
db_valstr=lua_tostring(L,I); db_idx= I>=0 ? I : db_top+I+1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment