Search found 4 matches

by Japple
Mon Aug 01, 2016 5:41 pm
Forum: Support and Development
Topic: Troubles with Lua class and OOP
Replies: 8
Views: 5568

Re: Troubles with Lua class and OOP

Thanks you all guys it works :awesome:
by Japple
Mon Aug 01, 2016 4:26 pm
Forum: Support and Development
Topic: Troubles with Lua class and OOP
Replies: 8
Views: 5568

Re: Troubles with Lua class and OOP

It works because you defined Player as a global in player.lua You generally don't want to do that since it pollutes the scope. You do local Player = {} and then return Player at the end. I'm still gettin an error https://s32.postimg.org/ozkxtmwk5/error2.png debug = true require 'player' player = Pl...
by Japple
Mon Aug 01, 2016 1:36 am
Forum: Support and Development
Topic: Troubles with Lua class and OOP
Replies: 8
Views: 5568

Re: Troubles with Lua class and OOP

You're supposed to return Player at the end of player.lua. I think i found another way to do it main debug = true require 'player' player = Player.new(1,2) print (player.x) function love.load(arg) end function love.update(dt) end function love.draw(dt) end player Player = {} Player.__index = Player...
by Japple
Sun Jul 31, 2016 10:59 pm
Forum: Support and Development
Topic: Troubles with Lua class and OOP
Replies: 8
Views: 5568

Troubles with Lua class and OOP

Hello guys, I'm kinda new to Lua and i have some previous experience with OOP in Java and C++. I've been playing with Love2d, i made a player class but i can't get it to work every time i load my game into love2d this error shows. https://s32.postimg.org/6tohidk5x/love.png Here's my main.lua debug =...