|
From: Chris Marrin <chris@marrin.com>But this is guaranteed to fail, isn't it? A Lua originated string is never going to have the same pointer as a C-generated string, right?
Erm, yes, I am an idiot :-D Those two pointers are pretty much guaranteed NOT to be equal *shames* What I meant was the equality check with your "foo" atom, as you described in the original topic:
And I will store the string pointer as the value of the atom. Now I want to go:if (lua_tostring(L, -1) == myFooAtom) // the strings match!
There you could add the || and strcmp to prevent your code from breaking in case pointer equality is not guaranteed, is what I meant. I'm not sure if this is a practical solution for your atom table in general, was rather just a thought.
Greets, Mark