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

  • Home
  • SEARCH
  • 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 9179233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:44:56+00:00 2026-06-17T17:44:56+00:00

Has anyone an idea, how to write a C# function which will return a

  • 0

Has anyone an idea, how to write a C# function which will return a LuaTable value (for example {1 = "example1", 2 = 234, "foo" = "Foo Example"}?
All types I’ve tested are returning LuaUserData values which are non pair/ipairable.
Thanks in advance.

–update–
The closest type to luaTable is in my opinion ListDictionary:

        [LuaFunc(Name = "table", Desc = "returns test LuaTable", Params = new string[] { })]
    public System.Collections.Specialized.ListDictionary table()
    {
        var k = new System.Collections.Specialized.ListDictionary(){
            {"1",1},
            {2,"2"}
        };

        return k;
    }

But it’s still recognized in Lua as LuaUserData and can not be pair/ipaired

  • 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-17T17:44:57+00:00Added an answer on June 17, 2026 at 5:44 pm

    There a two possible solutions for this problem.

    The first is, to let Lua return the table:

    LuaTable lt = (LuaTable) lua.DoString("return {1 = "example1", 2 = 234, "foo" = "Foo Example"}")[0];
    

    The second possibility is to create a new table

    LuaTable lt = lua.NewTable("ThisTable")
    lt["1"] = "example1"
    lt["2"] = 234
    lt["foo"] = "Foo Example"
    

    You could access the second table from Lua through

    ThisTable[1] = ThisTable["foo"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

has anyone an idea why I have the following problem with passing locals to
has anyone an idea how to convert a UIImage to cocos2d-x CCSprite. My latest
Has anyone an idea how pipebytes.com works ? I need to implement similar system
Has anyone got any idea why the menu is rendering below the rotating images
I wonder if anyone has an idea how you have to transform an image
Has anyone successfully tried minifying AND concatenating all the jqGrid locale files so that
Does anyone has any idea about importing the below data into R in an
i want to write a regex that will give me all chars that are
Do any one has any idea from where the below $ isUserLoggedInor $hideRegisterLink variable
Has anyone ever used the hidden class PackageParser in Android source code with java

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.