View unanswered posts | View active topics It is currently Fri Dec 27, 2024 8:02 am



Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
 How to add a library in Lua 
Author Message
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post How to add a library in Lua
How do you add a library in Lua? I tried to read a few "tutorials." I could not understand them, and the examples they gave I couldn't get those to work.


Wed Jun 02, 2010 10:57 pm
Profile
User avatar

Joined: Mon Jun 15, 2009 4:02 pm
Posts: 905
Reply with quote
Post Re: How to add a library in Lua
I'm barely qualified to respond, but have you had a look at Lord Tim's IRC Scene?

http://forums.datarealms.com/viewtopic.php?f=24&t=12079&start=0&hilit=irc+lord+tim

He used LuaSocket there, so I assume it would apply to your situation.


Wed Jun 02, 2010 11:10 pm
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: How to add a library in Lua
Short answer: use the require command. Depending on the library, it may actually already be included in the basic installation of CC.


Wed Jun 02, 2010 11:25 pm
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post Re: How to add a library in Lua
CaveCricket48 wrote:
How do you add a library in Lua? I tried to read a few "tutorials." I could not understand them, and the examples they gave I couldn't get those to work.


you should definitely post what library you're trying to "add"


Thu Jun 03, 2010 4:03 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: How to add a library in Lua
This is the library I'm trying to add right now.

Short test script:
Code:
allegro = require("ALLEG42")

 while 1 == 1 do

   if allegro:keystate(KEY_SPACE) then
   print("Space is pressed")
   end

 end



And that results in this error (using SciTE) when I attempt to run it:
Code:
>lua -e "io.stdout:setvbuf 'no'" "Macro.lua"
lua: error loading module 'ALLEG42' from file '.\ALLEG42.dll':
   The specified procedure could not be found.


stack traceback:
   [C]: ?
   [C]: in function 'require'
   Macro.lua:1: in main chunk
   [C]: ?
>Exit code: 1


I have the script and "ALLEG42.dll" in the same folder.


Fri Jun 04, 2010 4:05 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: How to add a library in Lua
I'm pretty sure the base filepath Lua refers to is the /Cortex Command/ directory.


Fri Jun 04, 2010 6:58 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: How to add a library in Lua
Well, this isn't for cortex command.


Fri Jun 04, 2010 7:06 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: How to add a library in Lua
the base directory of whatever you're putting lua into. so if your .exe/binary, whatever was in /home/cricket/game/ you'd put the .dll there too.


Fri Jun 04, 2010 7:31 am
Profile WWW
User avatar

Joined: Wed Jan 07, 2009 10:26 am
Posts: 4074
Location: That quaint little British colony down south
Reply with quote
Post Re: How to add a library in Lua
If all else fails paste it into a bunch of places at once until it works then narrow down the folder from there.


Fri Jun 04, 2010 7:57 am
Profile WWW
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post Re: How to add a library in Lua
Quote:
lua: error loading module 'ALLEG42' from file '.\ALLEG42.dll':
The specified procedure could not be found.


unless SCiTE is really that bad and calls file missing errors like this--

this seems to be more of a problem with the DLL you are using. "the specified procedure" could be referring to the necessary entry point.


Fri Jun 04, 2010 11:54 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: How to add a library in Lua
I'm pretty sure the dll is in the right place, it's probably my lack of library operation that's causing this problem. Is there a setup or something that you need to do to the library before attempting to use it?


Sat Jun 05, 2010 7:25 pm
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post Re: How to add a library in Lua
this is a really bad library. I read some of the documentation.

you really should just use LOVE if you want to render things in your own program.

have you tried running their example?


Quote:
5th of january, 2007. Release 0.39 version is ready.


Sun Jun 06, 2010 5:31 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: How to add a library in Lua
Daman wrote:
have you tried running their example?

No.

Daman wrote:
Quote:
5th of january, 2007. Release 0.39 version is ready.

That explains it.

Daman wrote:
you really should just use LOVE if you want to render things in your own program.

I also need keyboard functions, too. Does LOVE have keyboard stuff? (haven't read much on it)

Edit: Yep, it does. But I'm also trying to find something that can simulate a button "press" on the keyboard


Sun Jun 06, 2010 5:41 pm
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: How to add a library in Lua
Simulate how? like, virtual keypresses?


Sun Jun 06, 2010 11:19 pm
Profile WWW
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: How to add a library in Lua
Yes. So if you have the program to use some key pressing function set to the key that "T" is on, and you open up Notepad and run the program, a "T" will appear in Notepad.


Sun Jun 06, 2010 11:45 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 19 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.157s | 13 Queries | GZIP : Off ]