Created
November 13, 2009 15:37
-
-
Save jcromartie/233900 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
int lmoaux_pushObjCRetValue(lua_State *L, NSInvocation *invocation) { | |
void *ret; | |
const char *pRetCode = [[invocation methodSignature] methodReturnType]; | |
switch (*pRetCode) { | |
case '@': | |
ret = malloc(sizeof(id)); [invocation getReturnValue:ret]; lua_pushlightuserdata(L, (id)*ret); | |
break; | |
case 'f': | |
ret = malloc(sizeof(float)); [invocation getReturnValue:ret]; lua_pushnumber(L, (float)*ret); | |
break; | |
case 'i': | |
ret = malloc(sizeof(int)); [invocation getReturnValue:ret]; lua_pushinteger(L, (int)*ret); | |
break; | |
case 'l': | |
ret = malloc(sizeof(long)); [invocation getReturnValue:ret]; lua_pushnumber(L, (long)*ret); | |
break; | |
case 'd': | |
ret = malloc(sizeof(double)); [invocation getReturnValue:ret]; lua_pushnumber(L, (double)*ret); | |
default: | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment