[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: issue following array example in pil chapter 28.2
- From: David Rio <driodeiros@...>
- Date: Fri, 17 Feb 2012 20:44:48 -0500
Hi,
I was going over pil's chapter 28. After creating the array library
described in
28.1 I moved ahead and set a metatable for all the new userdatums of type array
so we avoid processing things that are not arrays.
The first thing to do is create the metatable within luaopen_array so the
metatable exists.
When adding that function call:
luaL_newmetatable(L, "LuaBook.array"); // in luaopen_array()
I get an error from malloc because it is trying to free memory that has
not been allocated:
lua(73040) malloc: *** error for object 0x10e922380: pointer being
freed was not allocated
I tried to dynamically allocate the second parameter of
luaL_newmetatable but the
problem persists.
I am using lua 5.1.4 under osx.
Any help would be appreciated,
-drd