Getting crazy with external module

Hi!

I’m desperate as i tried every possibilities imaginable to get this module call working but all i’ve got are miserable crashes and nil. Note : I’m a beginner and it’s the first time I use classes.

[lua]local wallClass = require(“wallclass”)
local newWall = wallClass.newWall
print(newWall) --> nil[/lua]

Then when I call the function in my code :
[lua]local wall = newWall(wallShape)
world:insert( wall )[/lua]

I get this in the console :
attempt to call upvalue ‘newWall’ (a nil value)

Any help appreciated.

Thanks [import]uid: 25327 topic_id: 8537 reply_id: 308537[/import]

Here is a bigger code snippet for those who would help :

main.lua
[lua]local wallClass = require(“wallclass”)
local spawnWall = wallClass.newWall

local world = display.newGroup()

local friction = 0.3

local shape = {
{ 0, 0, 352, 128}, { 480, 0, 352, 128 }, { 0, 128, 128, 352 },
{ 704, 128, 128, 224 }, { 0, 480, 832, 352 }, { 352, 288, 128, 32 },
{ 128, 480, 680, 8 }, { 360, 288, 112, 8 }, { 120, 128, 8, 352 }
}

for i=1, #shape do
local w = spawnWall(shape, friction)
world:insert( w )
end[/lua]

wallclass.lua :
[lua]module(…, package.seeall)

– Create wall
local function newWall(wallShape, roomFriction)

local wall = display.newRect( 0, 0, 16, 16 )
wall.width = wallShape[i][3]
wall.height = wallShape[i][4]
wall.xReference = -wall.width * 0.5
wall.yReference = -wall.height * 0.5
wall.x = wallShape[i][1]
wall.y = wallShape[i][2]
wall:setFillColor( 255, 255, 255 )
physics.addBody( wall, “static”, { friction=roomFriction } )

return wall

end[/lua] [import]uid: 25327 topic_id: 8537 reply_id: 30617[/import]

RESOLVED :
Wasn’t a global function in the module. [import]uid: 25327 topic_id: 8537 reply_id: 30620[/import]