Possible to make a server in LUA? Or possible to implement it? :)
Printable View
Possible to make a server in LUA? Or possible to implement it? :)
It's possible to write a C module that uses Lacewing.dll, but it has not been done. Might come in quite handy, actually.
I've been working on something for MechaBowser, that runs a server using pylacewing, loads up Lua in Python (using ctypes bindings I've made from scratch), and calls Lua functions for events like messageReceived, channelMessageReceived, acceptChannelMessage, etc., and also provides methods for doing stuff (sendMessage, sendChannelMessage, kick, etc.)
If more people are interested, I'll work towards a release :)
Mathias - SUPER INTERESTED!
If you able to make a custom server that can receive server messages and reply back to the channel/client interfacing with LUA then that would be awesome :D
I wonder what people find so much easier about Lua than Python..!
I find Python relatively easy too but it's just that I need to be able to compile Python code, import all of the right libraries, etc.
Mathias' solution sounds as though it would take care of all the nitty gritty such as handling the connections and would also be nice if it came precompiled.
Which would leave us only needing to add lua scripts to interpret the messages such as:
if ServerMessageRecieved == 'Ping' then
SendMessageToChannel( 'Pong' )
end
That would be awesome. (Even though I really do like the Python support already).
I'm interested in this as well.
Hope to see a release soon!
someone could theoretically write an xlua c module and have direct support for lua servers through that (via xlua or something)
... not like im volunteering or anything
This is the exact same case with Lua ;) Python code doesn't "compile" in that sense, you run it just like Lua. Also, if the implementation had been made in Lua, you would have had to import the various modules for the implementation too. Really, the examples given in the pylacewing wiki (and twisted examples/tutorials) are really helpful, and you shouldn't need anything else.Quote:
Originally Posted by netninja
With pylacewing, you don't have to "manage" connections whatsoever (I'm not sure where you got this idea from?), you change the ServerProtocol class so it behaves like you want to, and that's it. Also, precompiled? You still don't compile Python, even though you can build an executable using py2exe/cx_Freeze ;)Quote:
Originally Posted by netninja
Quote:
Originally Posted by netninja
vsCode:def messageReceived(self, message):
if message.value == 'Ping':
self.sendMessage('Pong', 0)
I honestly like the Python version better ;)Code:function pylacewing.messageReceived(message)
if message.value == "Ping" then
pylacewing.sendMessage("Pong", 0)
end
end
With that said, I think an official pylacewing-lua server would be a nice addition, even though I would like people to actually use the implementation directly ;)
Some people just prefer lua to python. It's an opinion thing. To be honest I'm still struggling to learn Python at a proficient level.
I probably wouldn't pursue lua for a full server implementation anyway. In fact I think lua support would be more useful client-side.
Mathias - I think I just expressed my lack of knowledge in python :P But having said that I took another look at the source code and I'm inspired to learn how to use it properly. It seems much easier than I thought after looking at the examples again. :)