TCL vs Lua - scripting a mmo server

前端 未结 6 2212
轻奢々
轻奢々 2021-02-20 14:11

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 se

6条回答
  •  借酒劲吻你
    2021-02-20 14:57

    As others have stated, both languages would work very well. A third option that would also likely work about as well is JavaScript, since it fits in about the same the same niche. Instead of trying to Woo you to one or the other (As I like both languages very much) I'll try to focus on some of the objective differences, and point out where I think one is ahead of the other.

    The most important issue in a game server is likely to be raw performance. Both languages are mature and well optimized, but both also recognize that some issues are best optimized by deferring to compiled code. Both languages use basically the same mechanism for performing this. From the point of view of the languages themselves, It looks like Lua is just a bit faster. link

    From the point of view of Libraries, which is the next big factor, Neither language requires the use of any libraries to be useful; that is both languages are very compact, as compared to languages such as Java which require large runtime libraries to be useful; Again, this is a consequence of their original designs requirements. Both languages have plentiful add-on libraries to choose from, But It's my impression at least that TCL has somewhat more variety in this category. tcl:( Tcl Extension Archive / Tcl Extension Repository ) lua: ( LuaForge )

    Another difference is between the core languages themselves. Both languages value simplicity over style, but that's where the similarity ends. Lua uses what might be familiar syntax to most programmers, with a very simple context free grammar. TCL syntax is also simple, but doesn't really have anything in common with other existing languages, although it looks superficially a bit like unix shell language. Tcl is probably only easier on non-programmers because its line oriented command syntax is pretty clear, but programmers experienced in other languages usually object to its arcane syntax. Neither one is terribly forgiving in terms of code generation, but both have strong metaprogramming facilities (comparable, but perhaps not as robust as CLISP macros).

提交回复
热议问题