简体   繁体   English

在C应用程序中隐藏Lua源代码

[英]Hiding Lua Source Code In C Application

I am currently developing a game in C and Lua. 我目前正在用C和Lua开发游戏。 Because I plan to sell my game when it is finished, I would like to keep the source code closed. 因为我计划在游戏结束时出售我的游戏,所以我想保持源代码关闭。 So my question is whether there is a way I can hide, or somehow access my Lua code from C, without the user being able to look. 所以我的问题是,是否有一种方法可以隐藏,或以某种方式从C访问我的Lua代码,而无需用户能够查看。 Right now, my executable is placed in the same place as my Lua code so it can be accessed. 现在,我的可执行文件与我的Lua代码放在同一个位置,因此可以访问它。

Thanks for reading this, and any help is appreciated. 感谢阅读本文,任何帮助表示赞赏。 Please ask me for more details if I am being too vague. 如果我太模糊,请告诉我更多细节。

Lua manual says : Lua手册

[Lua] Chunks can also be precompiled into binary form; [Lua] Chunks也可以预编译成二进制形式; see program luac for details. 请参阅程序luac了解详情。 Programs in source and compiled forms are interchangeable; 源代码和编译形式的程序是可以互换的; Lua automatically detects the file type and acts accordingly. Lua会自动检测文件类型并采取相应措施。

This means you can use luac (Lua compiler) to compile your Lua code to binary form, which will not be easily readable, but can still be disassembled to find out what it does (which can be done even with C if you are determined enough). 这意味着您可以使用luac (Lua编译器)将您的Lua代码编译为二进制形式,这将不易读取,但仍可以进行反汇编以找出它的作用(如果您足够坚定,即使使用C也可以这样做) )。

I think the correct answer is, that you can't. 我认为正确的答案是,你做不到。 You can only make life harder for the cracker. 你只能让饼干生活更加艰难。 Better protection schemes than compiling code into bytecode have been cracked. 已经破解了比将代码编译成字节码更好的保护方案。 If your game does not prove popular, it won't matter anyway. 如果您的游戏不受欢迎,那么无论如何都无关紧要。 Write the game first, then worry about hiding your code. 首先编写游戏,然后担心隐藏代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM