Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding Lua Source Code In C Application

Tags:

c

lua

I am currently developing a game in C and 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. Right now, my executable is placed in the same place as my Lua code so it can be accessed.

Thanks for reading this, and any help is appreciated. Please ask me for more details if I am being too vague.

like image 622
hyrumcoop Avatar asked Oct 11 '13 01:10

hyrumcoop


Video Answer


2 Answers

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.

like image 107
user1095108 Avatar answered Sep 22 '22 02:09

user1095108


Lua manual says:

[Lua] Chunks can also be precompiled into binary form; see program luac for details. Programs in source and compiled forms are interchangeable; Lua automatically detects the file type and acts accordingly.

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).

like image 20
che Avatar answered Sep 20 '22 02:09

che