Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TCL vs Lua - scripting a mmo server

Tags:

lua

tcl

I have a c++ server side project that I need to embed some sort of scripting into. It is part of an online MMO type of server. I have significant experience using TCL, and it seems like the natural fit. I've done a minimal amount of Lua in my game dev days, and I wonder if this might be a better language for embedded scripting. It is also nice to learn a new language. What are the relative strengths and weaknesses of TCL vs Lua? Thanks!

like image 646
Byron Whitlock Avatar asked Sep 10 '09 18:09

Byron Whitlock


2 Answers

Honestly, they're both extremely well suited to the task. Both are easy to embed in an application and have a fairly simple syntax. I know for a fact that it's extremely simple to add new commands (to interact with the application) in Tcl, and I'm told Lua is very good at this type of thing, too.

My recommendation would be to play around with Lua for a while to see how you like it (since you already know Tcl)... and then pick the one that feels most comfortable to you. If you're writing much of the code, you'll wind up working with it a lot, so you'll need something you can use, too. In the end, both language choices should be fairly easy for your end users to script in.

My personal preference is Tcl, both because I don't like Lua (I've done a reasonable amount of programming in it for Warcraft addsons) and because I love Tcl (I've done a LOT of programming in it for both professional and private work).

Edit: Added the note about both being easy for end users. Got 2 down votes and couldn't think of anything else that it might be for other than not clarifying the why part of my statement.

like image 160
RHSeeger Avatar answered Sep 23 '22 23:09

RHSeeger


I guess I'm the opposite of RHSeeger there. I've used both Lua and TCL embedded in games (online games, incidentally) and I wouldn't touch TCL again with a 10' bargepole if I had the choice. My very subjective opinion is that Lua is a sane language and TCL isn't. Relative to the other options for scripting languages, TCL syntax is very obscure to most people, with all the set and expr and dollar signs and lots of brackets etc. The only objective benefit it has is ease of embedding - but Lua is no slouch in that department either.

If this scripting interface is purely for you then you may as well go with TCL because Lua won't offer you anything new (unless object orientation is your thing). In the hands of a skilled user TCL is a reasonable tool. If, however, you expect less experienced users to use the system then go with Lua - the simpler syntax will buy them a lot of productivity.

like image 31
Kylotan Avatar answered Sep 22 '22 23:09

Kylotan