Zwoptex and external modules?

Hey Everyone!

I have been trying to get external modules to work with external modules but can’t get it to work!?

I keep getting the error: attempt to index local ‘test’ (a nil value)

in main i have:

[lua]local test = require (“test”)

local test1 = test.new()[/lua]

and in my external module:

[lua]local test = {}
local test_mt = {__index = test}

function test.new()

local newTest = {

}

return setmetatable(newTest, test_mt)

end

return test[/lua]

as you can see i even took out all my zwoptex code i first had :

[lua]local zwoptexData = require “testsheet2”
local data = zwoptexData.getSpriteSheetData()
local spriteSheet = sprite.newSpriteSheetFromData( “testsheet2.png”, data )

local spriteSet = sprite.newSpriteSet(spriteSheet,1,33)

sprite.add(spriteSet, “ufo”, 1, 1, 300, 0)
sprite.add(spriteSet, “explosion”, 2, 33, 300, 1)
local spriteInstance = sprite.newSprite(spriteSet)

spriteInstance.x = 200
spriteInstance.y = 100
spriteInstance:prepare(“ufo”)
spriteInstance:play(“ufo”)[/lua]

in newTest, guess i am not understanding this yet? but would really like some help:)

Thanks in advance=) [import]uid: 90942 topic_id: 16124 reply_id: 316124[/import]

bump. Same problem. [import]uid: 106739 topic_id: 16124 reply_id: 70801[/import]

Just tried copying and pasting your code (without the Zwoptex stuff) into a couple of sample files, and it seems to work fine for me.

If you’re getting a nil error with ‘test’, then the problem seems to be with loading the module in the first place.

[import]uid: 1294 topic_id: 16124 reply_id: 72966[/import]