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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:38:08+00:00 2026-05-21T19:38:08+00:00

I tried to provide some script features in my C# App. After some searches,

  • 0

I tried to provide some script features in my C# App.
After some searches, The Lua and LuaInterface looks like a reasonable way to do it.
By embedding a Lua VM in my C# code, I can load a Lua script and process methods
defined in the C# class without any problems.

However, I wonder is there a way to not only execute a lua script file in
my c# program, but also to have a lua interactive prompt in my program?
Thus I can type commands and see the returns immediately.

Any hint about where I should start to work on it will be very helpful!

Best Regards

  • 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-05-21T19:38:09+00:00Added an answer on May 21, 2026 at 7:38 pm

    Lua’s debug module contains a very basic interactive console: debug.debug() (the Lua manual suggests this module should be used only for debugging).

    If that doesn’t meet your needs, it’s easy enough to implement one yourself. If you were to write it in Lua itself, the absolute bare bones console would be:

    while true do
       io.write("> ")
       loadstring(io.read())()
    end
    

    That’ll crash on either a syntax or runtime error. A slightly less minimal version, which captures (and ignores) errors:

    while true do
       io.write("> ")
       local line = io.read()
       if not line then break end -- quit on EOF?
       local chunk = loadstring(line)
       if chunk then
          pcall(chunk)
       end
    end
    

    This could be enhanced by displaying syntax errors (second return value from loadstring on failure), runtime errors (second return value from pcall on failure), return values from evaluated code ([2..N] return values from pcall on success), etc.

    If you want to get really fancy, you can allow people to enter multi-line statements. Look at src/lua.c in the source distro to see how this is done.

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

Sidebar

Related Questions

Tried something like this: HttpApplication app = s as HttpApplication; //s is sender of
I put together a download script after some wonderful help from stack overflow the
I tried recently to use NAnt (beta 0.86.2962.0) to run some unit tests compiled
I'm trying to create a generic class in PHP that will provide a way
I am not an expert in PHP, still learning it. I'd like some hints
Assume I have an application, where user can provide script written in JavaScript to
Over Christmas I implemented some code to open a channel to my App Engine
Question: Is it possible to include some type of character (like \r or \n,
Could someone please provide some suggestions on how I can decrease the following for
Are there any libraries out there that provide some limited functionality for primitive shapes.

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.