Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8776585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:05:41+00:00 2026-06-13T19:05:41+00:00

I have a bunch of data in the form of a Lua table and

  • 0

I have a bunch of data in the form of a Lua table and I would like to parse that data into a usable structure in C#.

The problem with Lua tables is that there are optional fields, tables are very dynamic and are not just a dictionary with one type for the key and one type for the value. It’s possible to have one Lua table with both string and integer keys, and values of type integer, string and even table.

Sadly, the data that I’m parsing makes use of the dynamic nature of the language and isn’t really structured in any straight-forward way. This requires a dynamic representation of the data, using for example Dictionary<object, dynamic>.

The format of the data is e.g. (from http://ideone.com/9nzXvt)

local mainNode =
{
    [0] = 
        {
            Name = "First element",
            Comments = "I have comments!",
            Data = { {123, 456}; foo = { "bar" } }
        },
    [1337] =
        {
            Name = "Another element",
            Data = { {0}; foo = nil }
        }
}

Are there any libraries out there to do this? Is there any way to accomplish this without parsing the data character by character?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:05:43+00:00Added an answer on June 13, 2026 at 7:05 pm

    You can use the luainterface library

    There’s some sample code here.

    You’ll want to use a combination of DoFile (to load the file) and GetTable to read the table into a LuaTable object that you can use the result from c#. The LuaTable exposes an IDictionaryEnumerator through GetEnumerator.

    EDIT:

    if you had this table constructor:

    local t = { os.time() }
    print(t[1]);
    

    the function in the constructor would need to be executed to initialize the data.

    for constant literals, you can have string constants like so:

    local a = [==[
      hello
      there""\"]==]
    

    with different levels of equal signs

    a numeric literal can have the form:

    0X1.921FB54442D18P+1
    

    with P as a binary exponent.

    faithfully reproducing the lua syntax for constant literals without using the lightweight lua VM would require re-implementing a good chunk of the lua language spec. not much benefit it re-inventing the wheel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of data on Dutch individuals that I would like to
So in my app I have a bunch of data that I'd like to
I have to copy a bunch of data from one database table into another.
I have a bunch of name/email fields in my form like this: data[Friend][0][name] data[Friend][1][name]
I have a long-form data that represents a bunch of different configurations of different
I have a bunch of external forms that post data into databases via CFC's.
I have an NSMutableArray that is loaded into a table view. The data in
I have a bunch of overloaded functions that operate on certain data types such
I have a php array that has a bunch of data that I need
I have an app that has a bunch of Core Data that it needs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.