diff options
Diffstat (limited to 'xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c')
| -rw-r--r-- | xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c b/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c index a98baca02..adde214ca 100644 --- a/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c +++ b/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c @@ -1,27 +1,22 @@ #include <xmi.h> -static int add(lua_State* lua) { +static int add(lua_State *lua) { int a = lua_tointeger(lua, 1); int b = lua_tointeger(lua, 2); lua_pushinteger(lua, a + b); return 1; } -static int sub(lua_State* lua) { +static int sub(lua_State *lua) { int a = lua_tointeger(lua, 1); int b = lua_tointeger(lua, 2); lua_pushinteger(lua, a - b); return 1; } -int luaopen(foo, lua_State* lua) { - static const luaL_Reg funcs[] = { - {"add", add}, - {"sub", sub}, - {NULL, NULL} - }; +int luaopen(foo, lua_State *lua) { + static const luaL_Reg funcs[] = { { "add", add }, { "sub", sub }, { NULL, NULL } }; lua_newtable(lua); luaL_setfuncs(lua, funcs, 0); return 1; } - |
