Can anyone tell me what format this uh.. nested dictionary is?

cross-posted from: lemmy.nz/post/4294116

I have a file with content like this:


<span style="color:#323232;">item({
</span><span style="color:#323232;">     ["attr"] = {
</span><span style="color:#323232;">        ["size"] = "62091";
</span><span style="color:#323232;">        ["filename"] = "qBuUP9-OTfuzibt6PQX4-g.jpg";
</span><span style="color:#323232;">        ["stamp"] = "2023-12-05T19:31:37Z";
</span><span style="color:#323232;">        ["xmlns"] = "urn:xmpp:http:upload:0";
</span><span style="color:#323232;">        ["content-type"] = "image/jpeg";
</span><span style="color:#323232;">     };
</span><span style="color:#323232;">     ["key"] = "Wa4AJWFldqRZjBozponbSLRZ";
</span><span style="color:#323232;">     ["with"] = "email@address";
</span><span style="color:#323232;">     ["when"] = 1701804697;
</span><span style="color:#323232;">     ["name"] = "request";
</span><span style="color:#323232;">});
</span>

I need to know what format this is, and if there exists a tool in linux already to parse this or if I need to write one myself?

Thanks!

Bankenstein,

It’s Lua.

offspec,

It’s probaly Lua

callyral, (edited )
@callyral@pawb.social avatar

Lua function “item” called with argument of type table

The function is the outer part with the parentheses, the table is the inner part with the curly braces. [“attr”] is a table inside the table.

For example, to access (table)>attr>size you would write: table[“attr”][“size”] (assuming the table is named, that is, assigned to a variable called “table”)

moomoomoo309,
@moomoomoo309@programming.dev avatar

This is correct. You can also omit the parentheses on the function call in Lua if the only argument is a table or string literal.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #