Skip to content

Commit 13b50bd

Browse files
committed
don't manually invoke Inline::Lua as a module
1 parent 0cc2680 commit 13b50bd

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

t/6_lua_calls_perl_calls_lua.t

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
#!/usr/bin/env perl
2-
32
use strict;
43
use warnings;
5-
use Test::More tests => 1;
6-
use Inline::Lua;
74

8-
my $lua = Inline::Lua->new(DATA => \*DATA);
5+
use Inline Lua => <<'END_LUA';
6+
7+
function lua_curry(f, a, b)
8+
local g = f(a)
9+
return g(b)
10+
end
911
10-
# Bind the Perl sub into Lua
11-
$lua->set('perl_curry', \&curry);
12+
END_LUA
1213

13-
# Call Lua function that uses it
14-
is($lua->call('lua_curry', \&curry, 6, 7), 42, 'currying works');
14+
use Test::More tests => 1;
1515

1616
sub curry {
17-
my $arg = shift;
18-
return sub {
19-
return $arg * shift;
20-
};
17+
my $arg = shift;
18+
return sub {
19+
return $arg * shift;
20+
};
2121
}
2222

23-
__DATA__
24-
__Lua__
25-
function lua_curry (f, a, b)
26-
local g = f(a)
27-
return g(b)
28-
end
23+
is(lua_curry(\&curry, 6, 7), 42, 'currying works');

0 commit comments

Comments
 (0)