Page 1 of 1

How to use libraries?

Posted: Wed Jul 06, 2016 6:17 pm
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?

Re: How to use libraries?

Posted: Wed Jul 06, 2016 6:44 pm
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.)

Re: How to use libraries?

Posted: Wed Jul 06, 2016 6:59 pm
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!

Re: How to use libraries?

Posted: Wed Jul 06, 2016 7:07 pm
by zorg
Or, you require "HC-master" instead; best to understand why something happens :3