Data Realms Fan Forums
http://45.55.195.193/

How to add a library in Lua
http://45.55.195.193/viewtopic.php?f=73&t=18893
Page 1 of 2

Author:  CaveCricket48 [ Wed Jun 02, 2010 10:57 pm ]
Post subject:  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.

Author:  Petethegoat [ Wed Jun 02, 2010 11:10 pm ]
Post subject:  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.

Author:  Grif [ Wed Jun 02, 2010 11:25 pm ]
Post subject:  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.

Author:  Daman [ Thu Jun 03, 2010 4:03 am ]
Post subject:  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"

Author:  CaveCricket48 [ Fri Jun 04, 2010 4:05 am ]
Post subject:  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.

Author:  Grif [ Fri Jun 04, 2010 6:58 am ]
Post subject:  Re: How to add a library in Lua

I'm pretty sure the base filepath Lua refers to is the /Cortex Command/ directory.

Author:  CaveCricket48 [ Fri Jun 04, 2010 7:06 am ]
Post subject:  Re: How to add a library in Lua

Well, this isn't for cortex command.

Author:  Geti [ Fri Jun 04, 2010 7:31 am ]
Post subject:  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.

Author:  411570N3 [ Fri Jun 04, 2010 7:57 am ]
Post subject:  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.

Author:  Daman [ Fri Jun 04, 2010 11:54 pm ]
Post subject:  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.

Author:  CaveCricket48 [ Sat Jun 05, 2010 7:25 pm ]
Post subject:  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?

Author:  Daman [ Sun Jun 06, 2010 5:31 pm ]
Post subject:  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.

Author:  CaveCricket48 [ Sun Jun 06, 2010 5:41 pm ]
Post subject:  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

Author:  Geti [ Sun Jun 06, 2010 11:19 pm ]
Post subject:  Re: How to add a library in Lua

Simulate how? like, virtual keypresses?

Author:  CaveCricket48 [ Sun Jun 06, 2010 11:45 pm ]
Post subject:  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.

Page 1 of 2 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/