Skip to content

Propositon to change JMap.objectWithTable implementation #79

@CarlosLeyvaAyala

Description

@CarlosLeyvaAyala

Hi.
I want to propose a change to the implementation of JMap.objectWithTable in jc.lua.

Current implementation only changes the Lua table at a superficial level, thus not converting nested Lua tables to JMap.

I did this and seems to work quite fine:

function JMap.objectWithTable(t)
  local object = JMap.object()
  for k,v in pairs(t) do
    if type(v) == "table" then
      object[k] = JMap.objectWithTable(v)
    else
      object[k] = v
    end
  end
  return object
end

Nothing too fancy, as you can see. Only a recursive call to deep converting the table.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions