I don't think that's necessary. Just make it so you can write to lens_info.name from lua.
Not tested:
diff --git a/modules/lua/lua_lens.c b/modules/lua/lua_lens.c
--- a/modules/lua/lua_lens.c
+++ b/modules/lua/lua_lens.c
@@ -48,7 +48,12 @@
static int luaCB_lens_newindex(lua_State * L)
{
LUA_PARAM_STRING_OPTIONAL(key, 2, "");
- if(!strcmp(key, "name") || !strcmp(key, "focal_length") || !strcmp(key, "focus_distance") || !strcmp(key, "hyperfocal") || !strcmp(key, "dof_near") || !strcmp(key, "dof_far") || !strcmp(key, "af"))
+ if(!strcmp(key, "name"))
+ {
+ LUA_PARAM_STRING(value, 3);
+ strncpy(lens_info.name, value, 31);
+ }
+ else if(!strcmp(key, "focal_length") || !strcmp(key, "focus_distance") || !strcmp(key, "hyperfocal") || !strcmp(key, "dof_near") || !strcmp(key, "dof_far") || !strcmp(key, "af"))
{
return luaL_error(L, "'%s' is readonly!", key);
}