Esempio n. 1
0
File: table.c Progetto: Phuehvk/upb
int luaopen_upbtable(lua_State *L) {
  lupb_newlib(L, "upb.table", lupbtable_toplevel_m);

  // We define these here because they are not public (at least at the moment).
  lupbtable_setfieldi(L, "CTYPE_PTR", UPB_CTYPE_PTR);
  lupbtable_setfieldi(L, "CTYPE_INT32", UPB_CTYPE_INT32);

  lua_pushlightuserdata(L, NULL);
  lua_setfield(L, -2, "NULL");

  return 1;  // Return a single Lua value, the package table created above.
}
Esempio n. 2
0
File: table.c Progetto: alring/upb
int luaopen_upbtable(lua_State *L) {
  static char module_key;
  if (lupb_openlib(L, &module_key, "upb.table", lupbtable_toplevel_m)) {
    return 1;
  }

  // We define these here because they are not public.
  lupbtable_setfieldi(L, "CTYPE_PTR",   UPB_CTYPE_PTR);
  lupbtable_setfieldi(L, "CTYPE_CSTR",  UPB_CTYPE_CSTR);
  lupbtable_setfieldi(L, "CTYPE_INT32", UPB_CTYPE_INT32);

  lua_pushlightuserdata(L, NULL);
  lua_setfield(L, -2, "NULL");

  return 1;  // Return a single Lua value, the package table created above.
}