Author |
Message |
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
Petethegoat
Joined: Mon Jun 15, 2009 4:02 pm Posts: 905
|
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+timHe used LuaSocket there, so I assume it would apply to your situation.
|
Wed Jun 02, 2010 11:10 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
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 |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: How to add a library in Lua
Well, this isn't for cortex command.
|
Fri Jun 04, 2010 7:06 am |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
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 |
|
|
411570N3
Joined: Wed Jan 07, 2009 10:26 am Posts: 4074 Location: That quaint little British colony down south
|
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 |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
Daman
Joined: Fri Jan 26, 2007 3:22 am Posts: 1451
|
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 |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
Geti
Joined: Sun Jul 13, 2008 9:57 am Posts: 4886 Location: some compy
|
Re: How to add a library in Lua
Simulate how? like, virtual keypresses?
|
Sun Jun 06, 2010 11:19 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
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 |
|
|
|