1 --[==========================================================================[
2 luac.lua: lua compilation module for VLC (duplicates luac)
3 --[==========================================================================[
4 Copyright (C) 2010 the VideoLAN team
7 Authors: Antoine Cellerier <dionoea at videolan dot org>
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 --]==========================================================================]
25 [[ To compile a lua script to luac run:
26 vlc -I lua --lua-intf --lua-config 'luac={input="file.lua",output="file.luac"}'
32 vlc.msg.info("About to compile lua file")
33 vlc.msg.info(" Input is '"..tostring(config.input).."'")
34 vlc.msg.info(" Output is '"..tostring(config.output).."'")
36 if not config.input or not config.output then
37 vlc.msg.err("Input and output config options must be set")
38 for line in string.gmatch(usage,"([^\n]+)\n*") do
42 local bytecode = loadfile(config.input)
43 local output = io.open(config.output, "wb")
44 output:write(string.dump(bytecode))