summaryrefslogtreecommitdiff
path: root/tests/projects/swig/lua_c/src
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-27 22:40:17 +0800
committerruki <[email protected]>2021-09-27 22:40:17 +0800
commitc223db1bdd7e90d970b378e6d6755e977ceb4c6d (patch)
treeb0c16bbc54861f930a043f4a586d989a27532636 /tests/projects/swig/lua_c/src
parent9128fe7d5b84a27831ae2535a16547bb0b9b7d8e (diff)
improve swig
Diffstat (limited to 'tests/projects/swig/lua_c/src')
-rw-r--r--tests/projects/swig/lua_c/src/example.c27
-rw-r--r--tests/projects/swig/lua_c/src/example.i6
2 files changed, 4 insertions, 29 deletions
diff --git a/tests/projects/swig/lua_c/src/example.c b/tests/projects/swig/lua_c/src/example.c
index c4afe9779..06f76c542 100644
--- a/tests/projects/swig/lua_c/src/example.c
+++ b/tests/projects/swig/lua_c/src/example.c
@@ -1,25 +1,4 @@
-#include <stdio.h>
-#include "lua.h"
-#include "lualib.h"
-#include "lauxlib.h"
-
-extern int luaopen_example(lua_State* L); // declare the wrapped module
-
-int main(int argc,char* argv[])
-{
- lua_State *L;
- if (argc<2)
- {
- printf("%s: <filename.lua>\n",argv[0]);
- return 0;
- }
- L=lua_open();
- luaopen_base(L); // load basic libs (eg. print)
- luaopen_example(L); // load the wrappered module
- if (luaL_loadfile(L,argv[1])==0) // load and run the file
- lua_pcall(L,0,0,0);
- else
- printf("unable to load %s\n",argv[1]);
- lua_close(L);
- return 0;
+int fact(int n) {
+ return n;
}
+
diff --git a/tests/projects/swig/lua_c/src/example.i b/tests/projects/swig/lua_c/src/example.i
index f17b34a82..5724920da 100644
--- a/tests/projects/swig/lua_c/src/example.i
+++ b/tests/projects/swig/lua_c/src/example.i
@@ -1,6 +1,2 @@
%module example
-%{
-#include "example.h"
-%}
-int gcd(int x, int y);
-extern double Foo;
+int fact(int n);