Hey!
Don’t get this!
I have two tests:
main.lua
[lua]local dog = require (“em”)
local dog1 = dog.new ()[/lua]
em.lua
[lua]local dog = {}
local dog_mt = { __index = dog } – metatable
————————————————-
– PUBLIC FUNCTIONS
————————————————-
function dog.new() – constructor
local newDog = {
}
return setmetatable( newDog, dog_mt )
end
return dog[/lua]
and the other one :
main.lua
[lua]local dog = require (“ufo”)
local dog1 = ufo.new ()[/lua]
ufo.lua
[lua]local ufo = {}
local ufo_mt = { __index = ufo }
function ufo.new()
local newUfo = {
}
return setmetatable(newUfo, ufo_mt)
end
return ufo[/lua]
what am i doing wrong the first one works the second complains that :
attempt to index global ‘ufo’ (a nil value)
please if someone can help me i would love it, i want to continue with my game now not struggling with external modules:S
Kind regards Isak [import]uid: 90942 topic_id: 16271 reply_id: 316271[/import]
[import]uid: 84637 topic_id: 16271 reply_id: 60706[/import]