static void gethooktable (lv_State *L) { lv_pushlightuserdata(L, (void *)&KEY_HOOK); lv_rawget(L, LV_REGISTRYINDEX); if (!lv_istable(L, -1)) { lv_pop(L, 1); lv_createtable(L, 0, 1); lv_pushlightuserdata(L, (void *)&KEY_HOOK); lv_pushvalue(L, -2); lv_rawset(L, LV_REGISTRYINDEX); } }
/** * @brief Get the table associated with the given value * * It is considered a fatal error to call this function when the type of the * value is not a table * * @param value the lua value which is a table * @return the pointer to the table struct */ lhash_t* lv_gettable(luav value, u32 argnum) { if (!lv_istable(value)) { err_badtype(argnum, LTABLE, lv_gettype(value)); } return (lhash_t*) lv_getptr(value); }