1

I'm having trouble getting Lua 5.2.0 to work in Xcode 4. I built it using make linked in liblua.a, added the header path, and included it with Extern "C". I get no linker Errors. However when I run this code:

#include <iostream>

extern "C" {
#include "lua.h"
#include "lauxlib.h"
#include "lualib.h"
}

int main (int argc, char *argv[])
{
    lua_State *ls = lua_newstate(0, 0);

    lua_close(ls);
    return 0;
}

I get Thread 1: EXC_BAD_ACCESS (code 1, address=0x0) on line 11. Which I assume is telling me that I am in fact trying to make a call to something that does not exist. Any help would be greatly appreciated!

Thanks, Marc

1 Answer 1

3

You're passing a NULL memory allocation function to lua_newstate. No wonder it crashes. Perhaps you want to use luaL_newstate?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.