Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 9, 2009, 4:29:42 PM (15 years ago)
Author:
rgrieder
Message:

Update to tolua 1.0.93

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pch/src/tolua/lua/operator.lua

    r2710 r3127  
    7575    output(' if (\n')
    7676    -- check self
    77     output('     !'..'tolua_isusertype(tolua_S,1,"'..self.parent.type..'",0,&tolua_err) ||\n')
     77    local is_func = get_is_function(self.parent.type)
     78    output('     !'..is_func..'(tolua_S,1,"'..self.parent.type..'",0,&tolua_err) ||\n')
    7879    output('     !tolua_isnoobj(tolua_S,2,&tolua_err)\n )')
    7980    output('  goto tolua_lerror;')
     
    8687    output(' ',self.const,self.parent.type,'*','self = ')
    8788    output('(',self.const,self.parent.type,'*) ')
    88     output('tolua_tousertype(tolua_S,1,0);')
     89    local to_func = get_to_func(self.parent.type)
     90    output(to_func,'(tolua_S,1,0);')
    8991
    9092    -- check self
    9193    output('#ifndef TOLUA_RELEASE\n')
    92     output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in function \''..self.name..'\'",NULL);');
     94    output('  if (!self) tolua_error(tolua_S,"'..output_error_hook("invalid \'self\' in function \'%s\'", self.name)..'",NULL);');
    9395    output('#endif\n')
    9496
     
    103105    else
    104106        t = self.type
     107        local push_func = get_push_function(t)
    105108        new_t = string.gsub(t, "const%s+", "")
    106109        if self.ptr == '' then
    107110            output('   {')
    108111            output('#ifdef __cplusplus\n')
    109             output('    void* tolua_obj = new',new_t,'(tolua_ret);')
    110             output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
     112            output('    void* tolua_obj = Mtolua_new((',new_t,')(tolua_ret));')
     113            output('    ',push_func,'(tolua_S,tolua_obj,"',t,'");')
     114            output('    tolua_register_gc(tolua_S,lua_gettop(tolua_S));')
    111115            output('#else\n')
    112116            output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));')
    113             output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
     117            output('    ',push_func,'(tolua_S,tolua_obj,"',t,'");')
     118            output('    tolua_register_gc(tolua_S,lua_gettop(tolua_S));')
    114119            output('#endif\n')
    115120            output('   }')
    116121        elseif self.ptr == '&' then
    117             output('   tolua_pushusertype(tolua_S,(void*)&tolua_ret,"',t,'");')
     122            output('   ',push_func,'(tolua_S,(void*)&tolua_ret,"',t,'");')
    118123        else
    119124            if local_constructor then
    120                 output('   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"',t,'");')
     125                output('   ',push_func,'(tolua_S,(void *)tolua_ret,"',t,'");')
     126                output('    tolua_register_gc(tolua_S,lua_gettop(tolua_S));')
    121127            else
    122                 output('   tolua_pushusertype(tolua_S,(void*)tolua_ret,"',t,'");')
     128                output('   ',push_func,'(tolua_S,(void*)tolua_ret,"',t,'");')
    123129            end
    124130        end
     
    130136    output('#ifndef TOLUA_RELEASE\n')
    131137    output('tolua_lerror:\n')
    132     output(' tolua_error(tolua_S,"#ferror in function \''..self.lname..'\'.",&tolua_err);')
     138    output(' tolua_error(tolua_S,"'..output_error_hook("#ferror in function \'%s\'.", self.lname)..'",&tolua_err);')
    133139    output(' return 0;')
    134140    output('#endif\n')
Note: See TracChangeset for help on using the changeset viewer.