Root/lua/examples/lua_calls_C2/luapassing.c

1#include "lua.h"
2#include "lualib.h"
3#include "lauxlib.h"
4#include <stdio.h>
5
6
7static int myCfunc ( lua_State *L) {
8  printf ("lua SIE's test\n");
9  double trouble = lua_tonumber(L, 1);
10  lua_pushnumber(L, 16.0 - trouble);
11  return 1; }
12
13
14int luaopen_luapassing ( lua_State *L) {
15  static const luaL_reg Map [] = {
16    {"dothis", myCfunc},
17    {NULL,NULL} } ;
18  luaL_register(L, "cstuff", Map);
19  return 1; }
20

Archive Download this file

Branches:
master



interactive