Data::Lua - Parse variables out of Lua code.
use Data::Lua; my $vars = Data::Lua->parse("foo = 'bar'"); my $vars = Data::Lua->parse_file('lua.conf');
This module essentially evals Lua code and returns a hash reference. The returned hash reference contains all of the top-level variables, i.e. global variables assigned outside of any functions. It currently relies on Inline::Lua to do the actual code evaluation.
Any Lua code passed to this module should be trusted; there is no checking done to verify that the code is safe, and any top-level code (outside of functions) will be run when a parse method is called.
Parses the given string as Lua code and returns a hashref containing all of the variables defined, including functions. Returns undef if the string could not be parsed.
Returns undef if the string is not valid (i.e. not defined, or the empty string).
An exception is raised if there was a problem parsing the string.
Like parse() but parses the given file instead of a string.
Returns undef if the filename argument is not valid (i.e. not defined, or the empty string).
An exception is raised if there was a problem opening or parsing the file.
Inline::Lua
Lua (http://www.lua.org)
Copyright (c) 2007 Michael Fowler. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Michael Fowler <mfowler@cpan.org>
To install Data::Lua, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Lua
CPAN shell
perl -MCPAN -e shell install Data::Lua
For more information on module installation, please visit the detailed CPAN module installation guide.