diff options
author | Josh Haberman <jhaberman@gmail.com> | 2014-02-04 15:43:52 -0800 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2014-02-04 15:43:52 -0800 |
commit | 7d565f1e7a0f107506d3cf31ef2e33e22a504d2b (patch) | |
tree | 151a5102b0ded6e8ad098a86e692c1d14e390167 /upb/bindings/lua/upb.c | |
parent | 0fd2f830882402979a83010e89650e7245960d39 (diff) |
Sync from Google development.
Diffstat (limited to 'upb/bindings/lua/upb.c')
-rw-r--r-- | upb/bindings/lua/upb.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/upb/bindings/lua/upb.c b/upb/bindings/lua/upb.c index 1e7540a..022d689 100644 --- a/upb/bindings/lua/upb.c +++ b/upb/bindings/lua/upb.c @@ -326,6 +326,10 @@ static void lupb_fielddef_dosetlabel(lua_State *L, upb_fielddef *f, int narg) { upb_fielddef_setlabel(f, label); } +static void lupb_fielddef_dosetlazy(lua_State *L, upb_fielddef *f, int narg) { + upb_fielddef_setlazy(f, chkbool(L, narg, "lazy")); +} + static void lupb_fielddef_dosetname(lua_State *L, upb_fielddef *f, int narg) { CHK(upb_fielddef_setname(f, chkname(L, narg), &status)); } @@ -402,6 +406,12 @@ static int lupb_fielddef_setlabel(lua_State *L) { return 0; } +static int lupb_fielddef_setlazy(lua_State *L) { + upb_fielddef *f = lupb_fielddef_checkmutable(L, 1); + lupb_fielddef_dosetlazy(L, f, 2); + return 0; +} + static int lupb_fielddef_setname(lua_State *L) { upb_fielddef *f = lupb_fielddef_checkmutable(L, 1); lupb_fielddef_dosetname(L, f, 2); @@ -466,6 +476,7 @@ static int lupb_fielddef_new(lua_State *L) { else if (streql(key, "number")) lupb_fielddef_dosetnumber(L, f, v); else if (streql(key, "type")) lupb_fielddef_dosettype(L, f, v); else if (streql(key, "label")) lupb_fielddef_dosetlabel(L, f, v); + else if (streql(key, "lazy")) lupb_fielddef_dosetlazy(L, f, v); else if (streql(key, "is_extension")) lupb_fielddef_dosetisextension(L, f, v); else if (streql(key, "containing_type_name")) @@ -541,6 +552,12 @@ static int lupb_fielddef_label(lua_State *L) { return 1; } +static int lupb_fielddef_lazy(lua_State *L) { + const upb_fielddef *f = lupb_fielddef_check(L, 1); + lua_pushboolean(L, upb_fielddef_lazy(f)); + return 1; +} + static int lupb_fielddef_name(lua_State *L) { const upb_fielddef *f = lupb_fielddef_check(L, 1); lua_pushstring(L, upb_fielddef_name(f)); @@ -653,6 +670,7 @@ static const struct luaL_Reg lupb_fielddef_m[] = { {"is_extension", lupb_fielddef_isextension}, {"istagdelim", lupb_fielddef_istagdelim}, {"label", lupb_fielddef_label}, + {"lazy", lupb_fielddef_lazy}, {"name", lupb_fielddef_name}, {"number", lupb_fielddef_number}, {"subdef", lupb_fielddef_subdef}, @@ -663,6 +681,7 @@ static const struct luaL_Reg lupb_fielddef_m[] = { {"set_default", lupb_fielddef_setdefault}, {"set_is_extension", lupb_fielddef_setisextension}, {"set_label", lupb_fielddef_setlabel}, + {"set_lazy", lupb_fielddef_setlazy}, {"set_name", lupb_fielddef_setname}, {"set_number", lupb_fielddef_setnumber}, {"set_subdef", lupb_fielddef_setsubdef}, |