Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
bf92daa5
Commit
bf92daa5
authored
Feb 28, 2010
by
Antoine Cellerier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add error handling to luac intf.
parent
b8d7defe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
13 deletions
+32
-13
share/lua/intf/luac.lua
share/lua/intf/luac.lua
+32
-13
No files found.
share/lua/intf/luac.lua
View file @
bf92daa5
--[==========================================================================[
luac.lua: lua compilation module for VLC (duplicates luac)
--[==========================================================================[
Copyright (C) 2010
the VideoLAN team
Copyright (C) 2010
Antoine Cellerier
$Id$
Authors: Antoine Cellerier <dionoea at videolan dot org>
...
...
@@ -22,27 +22,46 @@
--]==========================================================================]
usage
=
[[ To compile a lua script to luac run:
vlc -I lua --lua-intf --lua-config 'luac={input="file.lua",output="file.luac"}'
[[
To compile a lua script to bytecode (luac) run:
vlc -I lua --lua-intf --lua-config 'luac={input="file.lua",output="file.luac"}'
Output will be similar to that of the luac command line tool provided with lua with the following arguments:
luac -o file.luac file.lua
]]
require
"string"
require
"io"
vlc
.
msg
.
info
(
"About to compile lua file"
)
vlc
.
msg
.
info
(
" Input is '"
..
tostring
(
config
.
input
)
..
"'"
)
vlc
.
msg
.
info
(
" Output is '"
..
tostring
(
config
.
output
)
..
"'"
)
function
compile
()
vlc
.
msg
.
info
(
"About to compile lua file"
)
vlc
.
msg
.
info
(
" Input is '"
..
tostring
(
config
.
input
)
..
"'"
)
vlc
.
msg
.
info
(
" Output is '"
..
tostring
(
config
.
output
)
..
"'"
)
if
not
config
.
input
or
not
config
.
output
then
vlc
.
msg
.
err
(
"Input and output config options must be set"
)
return
false
end
local
bytecode
,
msg
=
loadfile
(
config
.
input
)
if
not
bytecode
then
vlc
.
msg
.
err
(
"Error while loading file '"
..
config
.
input
..
"': "
..
msg
)
return
false
end
local
output
,
msg
=
io.open
(
config
.
output
,
"wb"
)
if
not
output
then
vlc
.
msg
.
err
(
"Error while opening file '"
..
config
.
output
..
"' for output: "
..
msg
)
return
false
else
output
:
write
(
string.dump
(
bytecode
))
return
true
end
end
if
not
config
.
input
or
not
config
.
output
then
vlc
.
msg
.
err
(
"Input and output config options must be set"
)
if
not
compile
()
then
for
line
in
string.gmatch
(
usage
,
"([^\n]+)\n*"
)
do
vlc
.
msg
.
err
(
line
)
end
else
local
bytecode
=
loadfile
(
config
.
input
)
local
output
=
io.open
(
config
.
output
,
"wb"
)
output
:
write
(
string.dump
(
bytecode
))
end
vlc
.
misc
.
quit
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment