Advertisement
Rochet2

crypt lua files

Apr 13th, 2014
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.63 KB | None | 0 0
  1. local scriptnames =
  2. {
  3.     "test.lua",
  4. }
  5.  
  6. local scriptfolder = "lua_scripts/"
  7.  
  8. for _, filename in ipairs(scriptnames) do
  9.     local byte = [[local script = "]]
  10.    local script, err = loadfile(scriptfolder..filename)
  11.    if(type(script) ~= "function") then
  12.        print("Error crypting "..filename)
  13.        print(err)
  14.    end
  15.    local text = string.dump(script)
  16.    for i = 1, text:len() do
  17.        byte = byte.."\\"..string.byte(text, i)
  18.    end
  19.    byte = byte..[[" assert(load(script))()]]
  20.  
  21.     local file = io.open(scriptfolder.."crypted_"..filename, "w")
  22.     file:write(byte)
  23.     file:flush()
  24.     file:close()
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement