I guess I’m posting to help others pretty often so hopefully someone can point out the (so obvious I’m missing it?) solution to this one.
The Error : “Segmentation Fault 11”, exit code 139 (OSX build 1005 and 982)
Basically, if I make more than one enemy using this code, Corona hard crashes and I get no information from it on possible code errors.
[code]-- enemy.lua
local M = {}
local options = {} – stuff is inside, sparing you the details
local enemyFrames = { 1, 2 } – enemy 1 has frame 1, enemy 2 has frame 2, easy peasy
function M.spawn(type)
local type = type or 1
local badguy = display.newImage( “sheet1.png”, enemyFrames[type])
return badguy
end
return M[/code]
This works just fine. Returns an enemy of whatever type I specified and it looks right.
[code]–main.lua
local enemy = require(“enemy”)
local monster1 = enemy.spawn(1)
local monster2 = enemy.spawn(2) – crashes on this line[/code]
Totally befuddled here. I’m not using any sort of complex metatable inheritance structure, so I must be making a fairly obvious mistake? [import]uid: 41884 topic_id: 35012 reply_id: 335012[/import]

[import]uid: 41884 topic_id: 35012 reply_id: 139271[/import]