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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:22:53+00:00 2026-06-12T22:22:53+00:00

In the game I’m making, I’m developing it mostly in C#, but I’d like

  • 0

In the game I’m making, I’m developing it mostly in C#, but I’d like to handle some of the game logic using Lua coroutines, because they can represent actions taken over multiple frames nicely. I’ve never actually used Lua before though so I’m not sure if this will work.
Ideally I’d like the C# game update function to be able to add one or more Lua coroutines to be executed to a queue, and then each frame, iterate over the queue, executing each coroutine until it yields or finishes.
I just want to know if this is possible, and if so, how to implement it, because it doesn’t seem to fit with the “lua_dofile” paradigm that Lua uses.

Here’s some C# pseudocode to show what I mean:

GameUpdate()
{
  // Update game logic
  // (which may add one or more Lua coroutines to the queue)

  // Update input, physics, sound, etc

  // In Lua:
  //  For each coroutine in queue,
  //  execute it until it reaches a yield,
  //  or it finishes, whichever comes first
}

GameRender()
{
  // Render a frame
}

UPDATE: This article (http://www.gamedev.net/topic/585128-luainterface-and-coroutines/) gives the answer I was looking for. In short, it is possible.

  • 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-12T22:22:55+00:00Added an answer on June 12, 2026 at 10:22 pm

    Yes it’s possible. It fits fine with the “dofile paradigm”: the host app exposes a means for the script to register a callback for the host to call; e.g. RegisterEventHandler(foo), hostTypeInstance.OnFoo = foo, etc.

    When the host runs a user script, the script can pass the host callback functions/coroutines, and the host saves handles to them.

    The host can call/resume the functions/coroutines every frame, whenever the mouse is clicked, or whatever else you’ve arraigned for them to be called.

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

Sidebar

Related Questions

I'm designing a game for windows 8 using HTML5 , but my game can't
I am porting a game using SpiderMonkey to Android. Because I need to integrate
I'm making a game that will allow content development and I'd like it to
Game engines like Quack, OGRE3D, JMonkeyEngine and Blender are used for PC games but
//Handle game logic mcPlayer.update(); //create question mcMathQu.update(); the first update function of external as
I'm making a game in Java, but can't figure out how to get information
The game I'm developing renders perfectly on the Java backend and on IE 10.
Permutation Game (30 Points) Alice and Bob play the following game: 1) They choose
I am making a game in java and I want to create a simulation
I write game. I use RequestWindowFeature(WindowFeatures.NoTitle); at splash screen, but how can I disable

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.