How to use libraries?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
swoodmood
Prole
Posts: 4
Joined: Wed Jul 06, 2016 6:11 pm

How to use libraries?

Post by swoodmood »

Hi!

I am currently trying to use the HC library, but I cannot figure out how. The library page on the wiki says it's already "in" Löve, but I cannot use HC with the example they provide on their document page here: http://hc.readthedocs.io/en/latest/index.html, so it clearly isn't. Trying to run the program gives me this error: Image

I tried to install HC with Luarocks and cloning it via git, but neither worked.

Can someone enlighten me on what I'm doing wrong?
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How to use libraries?

Post by zorg »

If you mean this [wiki]HC[/wiki] article, then i don't see where it says that it's "(included) in Löve".
It only says that it's a "pure lua" library, meaning it does not need Löve or any other libs to work; one could use it in any other lua-compatible program as well. (like one with a lua interpreter, for example)

Just download the repo from github, zipped is the easiest way, then unpack the files into the folder where you have your main.lua, and do

Code: Select all

HC = require 'HC'
, or just follow the example(s) on the docs site.
(You can put it in folders too, if they're not outside the one with your main.lua, though the require "path" will get longer; also, you'll need to use dots instead of slashes.)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
swoodmood
Prole
Posts: 4
Joined: Wed Jul 06, 2016 6:11 pm

Re: How to use libraries?

Post by swoodmood »

That worked! Thanks a lot!

For future readers: Be sure to rename the HC-master folder to just HC, or else you will get errors!
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: How to use libraries?

Post by zorg »

Or, you require "HC-master" instead; best to understand why something happens :3
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest