Created
April 9, 2012 13:21
-
-
Save fjolnir/2343350 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
objc.class_setMetaTable({objc.NSDictionary, objc.__NSCFDictionary, objc.NSMutableDictionary, objc.__NSCFMutableDictionary }, { | |
__tostring = objc.objToStr, | |
__index = function(self, key) | |
local val = objc.getInstanceMethodCaller(self, "objectForKey_")(self, Obj(key)) | |
if val ~= nil then | |
return val | |
end | |
return objc.getInstanceMethodCaller(self, key) | |
end, | |
__newindex = function(self, key, val) | |
return objc.getInstanceMethodCaller(self, "setObject_forKey_")(self, Obj(val), Obj(key)) | |
end | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment