Page 1 of 4

Problem with Libraries

Posted: Fri Mar 16, 2012 8:26 pm
by YGOFreak1997
Hey Guys, you can call me a noob, but i just don't get my code to function. It's a problem with some Libraries i think. I just want to implement a few Libraries like parts of Hump and LUBE. AnAL is working, but with LUBE and the other things, iget an error, i'll upload a zipped version of my project so that you can test the code. Please help me, this is my very first game and i want that my multiplayer works ^^

P.S.: If you have any Ideas to make the code or the File management better, tell me, too, please ^^

YGOFreak1997 ^^

Re: Problem with Libraries

Posted: Fri Mar 16, 2012 9:05 pm
by meoiswa
Please make a .love file for upload, you can find several guides on how to make them in this very forum.

Re: Problem with Libraries

Posted: Fri Mar 16, 2012 9:10 pm
by trubblegum
What he said, and read the docs that come with the lib.
According to LUBE's docs, it has dependencies.

Re: Problem with Libraries

Posted: Fri Mar 16, 2012 9:47 pm
by YGOFreak1997
Yeah, but seriously, I don't understand them ^^

And by the way, what ist wrong with a .rar-File? Just change the extension in .love and it's fine!

Re: Problem with Libraries

Posted: Fri Mar 16, 2012 9:54 pm
by tentus
YGOFreak1997 wrote:And by the way, what ist wrong with a .rar-File? Just change the extension in .love and it's fine!
False.

Please check things before asserting them.

Re: Problem with Libraries

Posted: Fri Mar 16, 2012 11:01 pm
by Robin
Not everyone can open .rar-files.

For those who can't open it now, here's the proper .love:
TEST.love
(28.96 KiB) Downloaded 292 times
First of all, this:

Code: Select all

	hump.class = require ("Libraries/Class")

	hump.vector= require ("Libraries/vector.lua")

	hump.camera = require ("Libraries/Camera.lua")

	local gwee = require ("Libraries/gwee.lua")

	require ("Libraries/LUBE.lua")

	require ("Libraries/slither.lua")
should be:

Code: Select all

	hump = {}

	hump.class = require ("Libraries.class")

	hump.vector= require ("Libraries.vector")

	hump.camera = require ("Libraries.camera")

	local gwee = require ("Libraries.gwee")

	require ("Libraries.LUBE")

	require ("Libraries.slither")
This is very important. Otherwise, your game will not work.

Moving on, you write LUBE instead of lube, and you write lube.server and lube.client instead of lube.Server and lube.Client. You also need to write lube.Client.init. That's init, not Init.

At this point I stopped trying to fix your main.lua.

Re: Problem with Libraries

Posted: Fri Mar 16, 2012 11:49 pm
by bartbes
The problem is, btw, that you should really require slither before lube. That shouldn't matter though, because if you're using a new enough version of hump.class you already have a Class Commons-compatible class lib.
Robin wrote: Moving on, you write LUBE instead of lube, and you write lube.server and lube.client instead of lube.Server and lube.Client. You also need to write lube.Client.init. That's init, not Init.
But not. The error is that he shouldn't be instantiating lube.Client or lube.Server (regardless of their spelling), but rather one of the subclasses. (So lube.udpClient or lube.tcpClient and lube.udpServer and lube.udpClient.)
Furthermore, you don't call init, that's what the class lib does for you when you create it.

It is, however, ambitious of you to try to use the library if you can't understand what the reference manual is saying. I agree, it is not newbie-friendly, but then, it isn't intended that way, it is a reference manual, and just that. I suggest you look up a tutorial (perhaps one linked in the thread) to get a grasp of what you're supposed to be doing, and then use the reference manual for its intended use, reference.

Re: Problem with Libraries

Posted: Sat Mar 17, 2012 9:56 am
by YGOFreak1997
Thank you very much ^^

Yeah i know it's difficult for a newbie like me to understand things like LUBE, but I just want to make a little Multiplayer Tank-Game, and i thought, LUBE is the right thing for that project.
It is, however, ambitious of you to try to use the library if you can't understand what the reference manual is saying. I agree, it is not newbie-friendly, but then, it isn't intended that way, it is a reference manual, and just that. I suggest you look up a tutorial (perhaps one linked in the thread) to get a grasp of what you're supposed to be doing, and then use the reference manual for its intended use, reference.
Yeah, i just didn't understand what you meant with the "Common classes" implementation...

But i now have another Problem: I'll reupload the file so that you can test it again. I get an error in the LUBE-File...

Re: Problem with Libraries

Posted: Sat Mar 17, 2012 10:00 am
by bartbes
This is an error you're likely to see a lot in your lua-life. If you see this, it means you called a function like this:

Code: Select all

class.method(args)
where it should've been:

Code: Select all

class:method(args)
(So a colon instead of a dot.)

Re: Problem with Libraries

Posted: Sat Mar 17, 2012 10:14 am
by YGOFreak1997
Thank you ^^

How you probably know by now, I am quite new to computer programming, but a class is kind of a program and a method is part of this "program" you can call within your code, right?

And if you say LUBE is too complicated for me, with what should I start instead? I just thought I set myself a goal which is not too difficult and I think i have found a good start...