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/class.lua

    r3127 r3138  
    6464-- return collection requirement
    6565function classClass:requirecollection (t)
    66     if self.flags.protected_destructor or (not self:check_public_access()) then
     66    if self.flags.protected_destructor then
    6767        return false
    6868    end
     
    148148    -- check for template
    149149    b = string.gsub(b, "^{%s*TEMPLATE_BIND", "{\nTOLUA_TEMPLATE_BIND")
    150     local t,_,T,I = string.find(b, '^{%s*TOLUA_TEMPLATE_BIND%s*%(+%s*\"?([^\",]*)\"?%s*,%s*([^%)]*)%s*%)+')
     150    local t,_,T,I = string.find(b, "^{%s*TOLUA_TEMPLATE_BIND%s*%(+%s*\"?([^\",]*)\"?%s*,%s*([^%)]*)%s*%)+")
    151151    if t then
    152152
     
    159159        local bs = string.gsub(b, "^{%s*TOLUA_TEMPLATE_BIND[^\n]*\n", "{\n")
    160160
    161         local Tl = split(T, " ")
    162         local tc = TemplateClass(n, p, bs, Tl)
    163 
    164         tc:throw(types, true)
    165         --for i=1,types.n do
    166         --    tc:throw(split_c_tokens(types[i], " "), true)
    167         --end
     161        -- replace
     162        for i =1 , types.n do
     163
     164            local Tl = split(T, " ")
     165            local Il = split_c_tokens(types[i], " ")
     166            local bI = bs
     167            local pI = {}
     168            for j = 1,Tl.n do
     169                Tl[j] = findtype(Tl[j]) or Tl[j]
     170                bI = string.gsub(bI, "([^_%w])"..Tl[j].."([^_%w])", "%1"..Il[j].."%2")
     171                if p then
     172                    for i=1,table.getn(p) do
     173                        pI[i] = string.gsub(p[i], "([^_%w]?)"..Tl[j].."([^_%w]?)", "%1"..Il[j].."%2")
     174                    end
     175                end
     176            end
     177            --local append = "<"..string.gsub(types[i], "%s+", ",")..">"
     178            local append = "<"..concat(Il, 1, table.getn(Il), ",")..">"
     179            append = string.gsub(append, "%s*,%s*", ",")
     180            append = string.gsub(append, ">>", "> >")
     181            for i=1,table.getn(pI) do
     182                --pI[i] = string.gsub(pI[i], ">>", "> >")
     183                pI[i] = resolve_template_types(pI[i])
     184            end
     185            bI = string.gsub(bI, ">>", "> >")
     186            Class(n..append, pI, bI)
     187        end
    168188        return
    169189    end
Note: See TracChangeset for help on using the changeset viewer.