Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Tolua update to v1.0.93 is not working properly and I would not know how to fix it. I have created a patch however, just in case we need it after all.

File:
1 edited

Legend:

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

    r3127 r3138  
    7575    output(' if (\n')
    7676    -- check self
    77     local is_func = get_is_function(self.parent.type)
    78     output('     !'..is_func..'(tolua_S,1,"'..self.parent.type..'",0,&tolua_err) ||\n')
     77    output('     !'..'tolua_isusertype(tolua_S,1,"'..self.parent.type..'",0,&tolua_err) ||\n')
    7978    output('     !tolua_isnoobj(tolua_S,2,&tolua_err)\n )')
    8079    output('  goto tolua_lerror;')
     
    8786    output(' ',self.const,self.parent.type,'*','self = ')
    8887    output('(',self.const,self.parent.type,'*) ')
    89     local to_func = get_to_func(self.parent.type)
    90     output(to_func,'(tolua_S,1,0);')
     88    output('tolua_tousertype(tolua_S,1,0);')
    9189
    9290    -- check self
    9391    output('#ifndef TOLUA_RELEASE\n')
    94     output('  if (!self) tolua_error(tolua_S,"'..output_error_hook("invalid \'self\' in function \'%s\'", self.name)..'",NULL);');
     92    output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in function \''..self.name..'\'",NULL);');
    9593    output('#endif\n')
    9694
     
    105103    else
    106104        t = self.type
    107         local push_func = get_push_function(t)
    108105        new_t = string.gsub(t, "const%s+", "")
    109106        if self.ptr == '' then
    110107            output('   {')
    111108            output('#ifdef __cplusplus\n')
    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));')
     109            output('    void* tolua_obj = new',new_t,'(tolua_ret);')
     110            output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
    115111            output('#else\n')
    116112            output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));')
    117             output('    ',push_func,'(tolua_S,tolua_obj,"',t,'");')
    118             output('    tolua_register_gc(tolua_S,lua_gettop(tolua_S));')
     113            output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
    119114            output('#endif\n')
    120115            output('   }')
    121116        elseif self.ptr == '&' then
    122             output('   ',push_func,'(tolua_S,(void*)&tolua_ret,"',t,'");')
     117            output('   tolua_pushusertype(tolua_S,(void*)&tolua_ret,"',t,'");')
    123118        else
    124119            if local_constructor then
    125                 output('   ',push_func,'(tolua_S,(void *)tolua_ret,"',t,'");')
    126                 output('    tolua_register_gc(tolua_S,lua_gettop(tolua_S));')
     120                output('   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"',t,'");')
    127121            else
    128                 output('   ',push_func,'(tolua_S,(void*)tolua_ret,"',t,'");')
     122                output('   tolua_pushusertype(tolua_S,(void*)tolua_ret,"',t,'");')
    129123            end
    130124        end
     
    136130    output('#ifndef TOLUA_RELEASE\n')
    137131    output('tolua_lerror:\n')
    138     output(' tolua_error(tolua_S,"'..output_error_hook("#ferror in function \'%s\'.", self.lname)..'",&tolua_err);')
     132    output(' tolua_error(tolua_S,"#ferror in function \''..self.lname..'\'.",&tolua_err);')
    139133    output(' return 0;')
    140134    output('#endif\n')
Note: See TracChangeset for help on using the changeset viewer.