Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are lots of reasons to want some form of scripting language embedded inside a C++ project. This is the primary use case for Lua, especially in game development. For example

- In a game, write quest logic in the scriptable language so that game devs can tinker with quest design without recompiling the game binary.

- "plugins" (usually UI plugins of some kind). Games like Elder Scrolls Online and World of Warcraft allow for 3rd parties to write UI extensions in Lua.

- Any other logic that you want to run and frequently modify without modifying the binary.

There are other great uses-cases that I can't think of right now, hopefully others can help.



Scripting in game development is also very helpful for programmers when bug fixing. I've had the situation where a game designer told me about some bug in an elaborate mission, and instead of playing through the entire mission to recreate the one thing that breaks, I could quickly with a few lines script the small scenario necessary to create the bug. (eg. spawn a car, attach car to road, make the car drive through the intersection, hit crash)


Another one could be:

- You already have working JS code that you don't want to rewrite for a new platform


Any non-trivial JS code is likely to be closely tied to the original platform/runtime for which it was meant, and thus hard to port. (Vs. purely computational)


I have experience of porting JS code from one environment to another. First I was using Delphi Application with MS Active Scripting and MS JScript Engine then moved to nodejs on linux, then back to windows on nodejs, and still have JS code originally written for MS Active Scripting. With nodejs vm module you may create needed context. I also was successfully using socket.io and code on top of it with MS Active Scripting based application by implementing simple WebSocket wrapper to Delphi component.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: