lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> On Nov 12, 2014, at 7:33 PM, Milind Gupta <milind.gupta@gmail.com> wrote:
> 
> Hi,
>         I have a lua script which has some scripts written inside string variables. Is it possible to have these scripts as compiled scripts so when I compile the main script using luac these scripts are not visible directly as text in the compiled file?
>        I tried to have the strings as string.dump(load(scriptAsString)) but that still has the text of the script although I see some binary characters appended.
> 
> Thanks,
> Milind
> 
> 

string.dump() will just give you the byte codes, not the source code. Are you sure about your code? And yes, once you have the byte code you can use it as input to load() to avoid having the source code distributed. Note, however, that byte code is NOT portable and so may not load if the target platform differs from the one on which it was compiled.

—Tim