Advertisement
Hendrix000007

Function encaptulation in classes

Jan 27th, 2012
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.39 KB | None | 0 0
  1. local _M = {}
  2.  
  3. function _M:getImage(item)
  4.    local imgSize = 25
  5.    local inventoryBox = display.newImageRect( item, imgSize, imgSize )
  6.    
  7.    local function onTouch(event)
  8.      if "ended" == event.phase then
  9.       print("touched rectangle")
  10.      end
  11.    end
  12.  
  13.    inventoryBox:addEventListener( "touch", onTouch )
  14.    return inventoryBox
  15.   end
  16.  
  17.   local xTemp = spawnObject()
  18.  
  19. return _M
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement