www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - lua for d

reply John <jpm9n virginia.edu> writes:
hi all,

I'm trying to learn d and a little bit of lua too. Some places I've found lua
"bindings" for d. Am I mistaken in thinking this will let me call lua scripts
from my d program?

I'm having trouble understanding what to do with these .d files and .lib files
(which I assume are gotten through implib used on the original lua dll's?)

I loaded a graphics utility with LoadLibraryA() and am wondering why I am told
to use a different method to get lua to work.

Thanks in advance.
Oct 10 2007
next sibling parent reply "Anders Bergh" <anders1 gmail.com> writes:
On 10/10/07, John <jpm9n virginia.edu> wrote:
 I'm trying to learn d and a little bit of lua too. Some places I've found lua
"bindings" for d. Am I mistaken in thinking this will let me call lua scripts
from my d program?

I think those are for Lua 5.0, if you want Lua 5.1 you can check out my bindings: http://code.google.com/p/dlua/ There's even a static Lua library for dmd compiled with dmc in case you don't want any DLL's lying around. There's also an import library in case you don't mind them. The Lua API is the same in D, so you can pretty much follow the "programming in lua" sections on the C API and then just adapt that code to D (which is pretty simple). Anders
Oct 10 2007
parent reply John <cmdrquan gmail.com> writes:
I'm trying that and I'm getting a compile error saying
luaL_register(...
and lua_dostring(..
symbols unrecognized or something. This is after the fix to your example
provided oct. 3. do i need to modify the declaration for those in lua.d in some
way?

I trying to do this on windows, if it means anything.

I'm learning a lot, so thanks. But I'm barely treading water so your help is
greatly appreciated.

Any idea when 0004 might be ready (using 0003)? Seems it might address these
issues.

John


Anders Bergh Wrote:

 On 10/10/07, John <jpm9n virginia.edu> wrote:
 I'm trying to learn d and a little bit of lua too. Some places I've found lua
"bindings" for d. Am I mistaken in thinking this will let me call lua scripts
from my d program?

I think those are for Lua 5.0, if you want Lua 5.1 you can check out my bindings: http://code.google.com/p/dlua/ There's even a static Lua library for dmd compiled with dmc in case you don't want any DLL's lying around. There's also an import library in case you don't mind them. The Lua API is the same in D, so you can pretty much follow the "programming in lua" sections on the C API and then just adapt that code to D (which is pretty simple). Anders

Oct 12 2007
parent Hoenir <mrmocool gmx.de> writes:
Anders Bergh schrieb:
 For 0004 you could just use SVN... it was ages ago I touched any of
 this stuff :-(

Mar 03 2008
prev sibling parent "Anders Bergh" <anders1 gmail.com> writes:
On 10/12/07, John <cmdrquan gmail.com> wrote:
 I'm trying that and I'm getting a compile error saying
 luaL_register(...
 and lua_dostring(..
 symbols unrecognized or something. This is after the fix to your example
provided oct. 3. do i need to modify the declaration for those in lua.d in some
way?

 I trying to do this on windows, if it means anything.

 I'm learning a lot, so thanks. But I'm barely treading water so your help is
greatly appreciated.

 Any idea when 0004 might be ready (using 0003)? Seems it might address these
issues.

 John

Maybe you aren't using the import libraries, I mostly used it on Linux and didn't really have any issues. I know I've used it on Windows though, and all it needed was the lua51.lib added to the dmd command line. For 0004 you could just use SVN... it was ages ago I touched any of this stuff :-( Anders
Oct 12 2007