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 7796515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:23:44+00:00 2026-06-01T23:23:44+00:00

I have a method called GetParameter in C. And I want to use it

  • 0

I have a method called GetParameter in C. And I want to use it from Lua. This method is going to return some values to Lua again.

The way that Im building the table in C is the most common way:

lua_newtable(L);
for (int i = 0; i < parameters; i++)
{
    lua_pushnumber(L,i);
    lua_pushstring(L,myParameter);
    lua_settable(L,-3);
}

In all examples that I’ve seen, after this, you have to set the result table with lua setGlobal:

 //set name for the result
 lua_setglobal(ptLuaState, "resultTable");

With this method, I can access to the result table in lua, like this:

GetParameter("V111","V111Parameter")
printTable(resultTable);

Doing this all things goes well, but, there is another way to do this without using setglobal? I’ve tried to do something like:

local mytable=GetParameter("V111","V111Parameter");

but doesnt work. Using global variables is better? how can I get the result table without make the setglobal?

thanks in advance!

  • 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-01T23:23:46+00:00Added an answer on June 1, 2026 at 11:23 pm

    Don’t call setglobal and return 1 from your C function. That tells lua there is 1 return value from your function, and your last example will work.

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

Sidebar

Related Questions

Suppose that I have a method called doSomething() and I want to use this
Trying to use GridBagLayout. I have the method called buildLabel. This creates three label.
I have a method called revisions, and I want to be able use the
I have a method called BindItems() and this method gets the values to a
I have a class with a method called DataIn(int InputID, string CSVValue) , this
I have method called SColl. This method invokes a webservice. When using parallel.invoke I
I have a method called -(IBAction)setPicker:(id) sender Basically this method substitutes a keyboard into
I have a method called Rotate and I am calling it from another method
I have a method called getCurrentCycle in one of my viewControllers that I use
I have a method called GetObjectsRelatedToAType, e.g. GetCarsRelatedToDealership. Which approach is better from a

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.