コード例 #1
0
/**
 * lupb_msgfactory_new()
 *
 * Handles:
 *   msgfactory = upb.MessageFactory(symtab)
 *
 * Creates a new, empty MessageFactory for the given SymbolTable.
 * Message classes will be created on demand when the user calls
 * msgfactory.get_message_class().
 */
static int lupb_msgfactory_new(lua_State *L) {
  const upb_symtab *symtab = lupb_symtab_check(L, 1);

  lupb_msgfactory *lmsgfactory =
      lupb_newuserdata(L, sizeof(lupb_msgfactory), LUPB_MSGFACTORY);
  lmsgfactory->factory = upb_msgfactory_new(symtab);
  lupb_uservalseti(L, -1, LUPB_MSGFACTORY_SYMTAB, 1);

  return 1;
}
コード例 #2
0
ファイル: table.c プロジェクト: alring/upb
static int lupbtable_symtab_symtab(lua_State *L) {
  const upb_symtab *s = lupb_symtab_check(L, 1);
  lupbtable_pushstrtable(L, &s->symtab);
  return 1;
}