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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:57:42+00:00 2026-06-12T09:57:42+00:00

I finally was able to get Lua running with my compiler using C++. I

  • 0

I finally was able to get Lua running with my compiler using C++. I now tried starting some tutorials and the first program won’t do anything. I downloaded the code they used and it still did nothing. No errors however. Test prints out fine but I get no response from the luaL_dostring. I am using v5.1.4-46. Is it possible that i installed it incorrectly in some way that doesn’t result in errors? I printed out the memory address of the lua state and that seems to be working. If someone could give me some sample code to run I would really appreciate it.

Here’s the code:

#include <lua.hpp>
#include <iostream>
#include <string>

using namespace std;

int main()
{
    lua_State *L = lua_open();
    luaL_openlibs(L);

    cout << "Test" << endl;

    luaL_dostring(L, "print(\"Hello from Lua!\n\")");

    lua_close(L);
    return 0;
}
  • 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-12T09:57:44+00:00Added an answer on June 12, 2026 at 9:57 am

    Your dostring syntax generates invalid Lua code… “\n” gets passed to lua parser before execution. you need a “\\n”… think so. So your “luaL_dostring” error code is actually a syntax fault. funny thing…

    you should not use dostring for more than testing.

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

Sidebar

Related Questions

I'm finally able to get an Access Token, now I'm very confused as how
UPDATE: It Is Now Working I was able to finally get it completed. A
Finally i tried to draw a line using OpenGL ES framework in XCode 4.2
I'd like to get the list of running processes using a java applet running
I was able to get some help earlier today, but I didn't have everything
Yesterday I tried implementing jScrollPane on a resultsSuccess.php template and wasn't able to get
I've been able to finally get python-openid to authenticate a user, but I'm not
Finally, I have been able to get through reflection, a member of type Func<T,
After fighting with different things here and there, I was finally able to get
I have a Java Program where I get data from a different source. some

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.