lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

You could always combine the pointer equality and strcmp() (and/or other methods of equality testing), e.g:

char* myFoo = "foo";
char* prop = lua_tostring(L, -1);
if((prop == myFoo) || (strcmp(prop, myFoo) == 0))

Obviously if the pointers are equal then you are sure the strings are equal, so there's no harm in using this to your advantage (without relying solely on this) if chances are good that you can prevent the strcmp that way (or any other performance hits that other approaches impose).