diff options
| author | ruki <[email protected]> | 2021-07-29 22:43:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-07-29 22:43:45 +0800 |
| commit | e2067d1b58aeec0024ac2f52e7599a4893b15f14 (patch) | |
| tree | 783e31fb7410f9e2eb17a47fbb6b7a6b1c09a74b /tests/projects/vala/lua | |
| parent | 6acd768b2f692c49ddc89b5fffdfed0bf75744dc (diff) | |
impl vala rule
Diffstat (limited to 'tests/projects/vala/lua')
| -rw-r--r-- | tests/projects/vala/lua/src/main.vala | 21 | ||||
| -rw-r--r-- | tests/projects/vala/lua/src/sub/stub.vala | 21 | ||||
| -rw-r--r-- | tests/projects/vala/lua/xmake.lua | 10 |
3 files changed, 52 insertions, 0 deletions
diff --git a/tests/projects/vala/lua/src/main.vala b/tests/projects/vala/lua/src/main.vala new file mode 100644 index 000000000..8e8a32da0 --- /dev/null +++ b/tests/projects/vala/lua/src/main.vala @@ -0,0 +1,21 @@ +using Lua; + +static int my_func (LuaVM vm) { + stdout.printf ("Vala Code From Lua Code! (%f)\n", vm.to_number (1)); + return 1; +} + +static int main (string[] args) { + + string code = """ + print "Lua Code From Vala Code!" + my_func(33) + """; + + var vm = new LuaVM (); + vm.open_libs (); + vm.register ("my_func", my_func); + vm.do_string (code); + + return 0; +} diff --git a/tests/projects/vala/lua/src/sub/stub.vala b/tests/projects/vala/lua/src/sub/stub.vala new file mode 100644 index 000000000..7b3a2d4d8 --- /dev/null +++ b/tests/projects/vala/lua/src/sub/stub.vala @@ -0,0 +1,21 @@ +using Lua; + +static int my_func2 (LuaVM vm) { + stdout.printf ("Vala Code From Lua Code! (%f)\n", vm.to_number (1)); + return 1; +} + +static int main2 (string[] args) { + + string code = """ + print "Lua Code From Vala Code!" + my_func(33) + """; + + var vm = new LuaVM (); + vm.open_libs (); + vm.register ("my_func", my_func2); + vm.do_string (code); + + return 0; +} diff --git a/tests/projects/vala/lua/xmake.lua b/tests/projects/vala/lua/xmake.lua new file mode 100644 index 000000000..e149fb6d3 --- /dev/null +++ b/tests/projects/vala/lua/xmake.lua @@ -0,0 +1,10 @@ +add_rules("mode.release", "mode.debug") + +add_requires("lua", "glib") + +target("test") + set_kind("binary") + add_rules("vala") + add_files("src/**.vala") + add_packages("lua", "glib") + add_values("vala.packages", "lua") |
