0
我试图创建2个不同的功能NCAR表:设置ANS main_frame如何在一个表lua中创建多个函数? (电晕SDK)
local ncar=
{
img=display.newImageRect("test_car.png",50,120,true);
x=0;
y=0;
frames=0;
setup=function(self)
return self;
end
main_frame=function(self)
self.frames=self.frames+1;
return function(event)
self.img.x=self.x;
self.img.y=self.y;
end
end
}
但是编译器说,他希望看到“}”,其中第二个函数(main_frame在这种情况下)开始,当我添加它。原因是什么?
疯狂,我不知道Lua允许分号作为字段分隔符+1 – dualed 2013-03-10 12:08:41