Example #1
0
//     static %gc wxXmlResource* Set(%ungc wxXmlResource *res);
static int LUACALL wxLua_wxXmlResource_Set(lua_State *L)
{
    // wxXmlResource res
    wxXmlResource * res = (wxXmlResource *)wxluaT_getuserdatatype(L, 1, wxluatype_wxXmlResource);
    if (wxluaO_isgcobject(L, res)) wxluaO_undeletegcobject(L, res);
    // call Set
    wxXmlResource* returns = (wxXmlResource*)wxXmlResource::Set(res);
    if (!wxluaO_isgcobject(L, returns)) wxluaO_addgcobject(L, returns, wxluatype_wxXmlResource);
    // push the result datatype
    wxluaT_pushuserdatatype(L, returns, wxluatype_wxXmlResource);

    return 1;
}
Example #2
0
//     static %gc wxConfigBase* Set(%ungc wxConfigBase *pConfig = NULL );
static int LUACALL wxLua_wxConfigBase_Set(lua_State *L)
{
    // get number of arguments
    int argCount = lua_gettop(L);
    // wxConfigBase pConfig = NULL
    wxConfigBase * pConfig = (argCount >= 1 ? (wxConfigBase *)wxluaT_getuserdatatype(L, 1, wxluatype_wxConfigBase) : NULL);
    if (wxluaO_isgcobject(L, pConfig)) wxluaO_undeletegcobject(L, pConfig);
    // call Set
    wxConfigBase* returns = (wxConfigBase*)wxConfigBase::Set(pConfig);
    if (!wxluaO_isgcobject(L, returns)) wxluaO_addgcobject(L, returns, wxluatype_wxConfigBase);
    // push the result datatype
    wxluaT_pushuserdatatype(L, returns, wxluatype_wxConfigBase);

    return 1;
}
// %override wxLua_function_isgcobject
// %function bool isgcobject(void* object)
static int LUACALL wxLua_function_isgcobject(lua_State *L)
{
    bool ret = false;
    if (wxlua_iswxuserdatatype(wxluaT_type(L, 1)))
    {
        void* obj_ptr = wxlua_touserdata(L, 1, false);
        ret = wxluaO_isgcobject(L, obj_ptr);
    }

    lua_pushboolean(L, ret);
    return 1;
}
// %function %gc dpm *dpm_netx5_create(voidptr_long pvHandle)
static int LUACALL wxLua_function_dpm_netx5_create(lua_State *L)
{
    // voidptr_long pvHandle
    long pvHandle = (long)wxlua_getnumbertype(L, 1);
    // call dpm_netx5_create
    dpm* returns = (dpm*)dpm_netx5_create((void*)pvHandle);
    if (!wxluaO_isgcobject(L, returns)) wxluaO_addgcobject(L, returns);
    // push the result datatype
    wxluaT_pushuserdatatype(L, returns, wxluatype_dpm);

    return 1;
}
// %function %gc romloader *romloader_openocd_create(voidptr_long pvHandle)
static int LUACALL wxLua_function_romloader_openocd_create(lua_State *L)
{
    // voidptr_long pvHandle
    long pvHandle = (long)wxlua_getnumbertype(L, 1);
    // call romloader_openocd_create
    romloader* returns = (romloader*)romloader_openocd_create((void*)pvHandle);
    if (!wxluaO_isgcobject(L, returns)) wxluaO_addgcobject(L, returns);
    // push the result datatype
    wxluaT_pushuserdatatype(L, returns, wxluatype_romloader);

    return 1;
}
// %override wxLua_function_ungcobject
// %function bool ungcobject(void* object)
static int LUACALL wxLua_function_ungcobject(lua_State *L)
{
    bool ret = false;

    int l_type = lua_type(L, 1);

    if (!wxlua_iswxluatype(l_type, WXLUA_TUSERDATA))
        wxlua_argerror(L, 1, wxT("a 'userdata'"));

    void* o = wxlua_touserdata(L, 1, false);

    if (wxluaO_isgcobject(L, o))
    {
        ret = wxluaO_undeletegcobject(L, o);
    }

    lua_pushboolean(L, ret);
    return 1;
}