static int luaH_timer_new(lua_State *L) { luaH_class_new(L, &timer_class); ltimer_t *timer = luaH_checktimer(L, -1); timer->id = TIMER_STOPPED; return 1; }
static int luaH_timer_new(lua_State *L) { luaH_class_new(L, &timer_class); ltimer_t *timer = luaH_checkudata(L, -1, &timer_class); timer->ref = NULL; timer->timer_id = TIMER_STOPPED; return 1; }
/** * Creates a new download on the stack. * * \param L The Lua VM state. * * \luastack * \lvalue A table containing properties to set on the download. * \lreturn A new \c download object. */ static gint luaH_download_new(lua_State *L) { luaH_class_new(L, &download_class); download_t *download = luaH_checkdownload(L, -1); /* create download from constructor properties */ WebKitNetworkRequest *request = webkit_network_request_new( download->uri); download->webkit_download = webkit_download_new(request); g_object_ref(G_OBJECT(download->webkit_download)); /* raise error signal on error */ g_signal_connect(G_OBJECT(download->webkit_download), "error", G_CALLBACK(error_cb), download); /* return download */ return 1; }