View Full Version : Lua questions
Ron
October 13th, 2002, 01:55 PM
I've been experimenting with loadlib, and it looks nice but its not really usable to add new Lua functionality. :( This is because the DLL memory space separation, if the DLL calls lua functions they need to modify the lua state and this is likely to go bezerk this way ). I could be wrong, I'd love to be wrong on this one so if anyone thinks otherwise please step forward.
Ron
October 13th, 2002, 01:55 PM
Yes I thinks so :-)
I have seen a loadlib library that allows you to load your own DLL's I have not tested it though, and I'm not 100% sure its available for windows. If there is interest in this I'll see if I can add it before the final release tomorow.
External Lua scripts can also be called with
dofile("../lua/http.lua")
Ron
October 13th, 2002, 01:55 PM
I can do to Lua whatever I like, so a DLL is very much possible....
Mark,
http://www.tecgraf.puc-rio.br/~rborges/loadlib/
For an example of the stuff that I added see this file
http://www.girder.nl/download.php?Link=407
(basically all std libraries, LuaSocket and some bitwise operators)
gotta run, I'll be back later today
Ron
October 13th, 2002, 01:55 PM
whoohooo, loadlibrary works :-), thanks for the suggestions!
Try it :
http://www.girder.nl/temp/gvms_lua.zip
Ron
October 13th, 2002, 01:55 PM
Great Idea!!!!! I'm currently writing some docs for the Lua scripting engine, right after those are finised I'll get to it!!
Ron
October 13th, 2002, 01:55 PM
Mark, the new release is out, it has an updated API 2 to allow plugins access to Lua.
http://www.girder.nl/phpBB2/viewtopic.php?p=13619#13619
Mark F
October 13th, 2002, 01:55 PM
... if anyone thinks otherwise please step forward.
I'd like to step forward but I don't know the answer. :)
Could you supply a link to the LoadLib library you are talking about? I'd like to take a look. :)
Mark F
October 13th, 2002, 01:55 PM
WOW! :o
Now I have 6-7 more weeks of stuff to read. :D
Any chance the "gir_lua_libopen" routine in a plugin (if it exists) could be called during the init of the plugin to allow the plugin to participate in this exciting new world in an easy fashion? :) This would save the plugin writer from having to execute the standard LUA startup stuff for the user through run_parser() AND would allow Girder-LUA extensions to be encapsulated the same as other Girder extensions (as a plugin).
Thanks, Ron. I think this interface just opened the door for Girder to achieve a new level.
MMcM
October 13th, 2002, 01:55 PM
Can LUA be compiled into its own DLL, so that both GVMS.DLL and loadlib dynamically import its symbols and thereby share? Or does it only come in static link form?
drobertson
October 13th, 2002, 01:55 PM
I have looked at the examples of lua programming supplied by Ron. I am intriqued by the TCP example. This example uses a third party package.
So my question is: Is it possible for us (Girder users) to write and define our own C/C++ libraries to be used by Girder/Lua, or do they have to be incorporated into the GVMS.dll?
And if the answer is YES, how do we do it?
David
drobertson
October 13th, 2002, 01:55 PM
So does this mean that you included the TCP/UDP/HTTP/socket stuff (from your lua examples) into the GVMS.dll? If this is what you did, what else did you include? i.e. all the standard libraries, LuaSocket
Thanks for the help Ron.
julian
January 7th, 2003, 12:40 PM
Sorry, but I can't work out how to use this at all.
I have a stand alone lua script that works on linux using this syntax:
loadmodule("socket")
host = "localhost"
port = 8765
s=connect(host,port)
...
I've seen references to "loadlib" instead of loadmodule and tried:
loadlib("C:\Program Files\girder32\plugins\luasocket.dll")
host = "localhost"
port = 8765
s=connect(host,port)
but I get an error message saying the global "connect" is null.
How do I get this to work?
Julian
Ron
January 7th, 2003, 12:49 PM
Even easier :-)
Go to the settings window, plugin tab. Find the Lua socket library in the list, check it and you are ready to roll!!
julian
January 7th, 2003, 04:27 PM
:D
Julian
Powered by vBulletin® Version 4.1.8 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.