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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:44:50+00:00 2026-05-22T21:44:50+00:00

hope you’re having a good day. I have been programming a IRC chatbot in

  • 0

hope you’re having a good day.

I have been programming a IRC chatbot in Lua the past few days, and finally I want to start implementing multiple server support into it.

So far, I have created the irc “object” to manage each server, and all that happy stuff – Now, I am having problems with threading.

Lua, as you probably know, doesn’t have thread support built-in. LuaLanes and LuaThreads seemed like the closest to what I wanted to use, in terms of libraries. What made me choose LuaLanes is because LuaThreads requires a modified lua core. Plus the “lindas” feature of LuaLanes caught my eye (for later use in plugins)

Anyway, the issue that I’m having is when you generate a lane using function middleman (for example), which then calls another function sqr (for example). if you generate the function like lanes.gen({globals = _G}, middleman), middleman will have access to everything in your current global scope, which is exactly what I want. The problem is, if middleman calls sqr, and sqr uses something from the global scope, it throws an error, almost as if _G suddenly became empty.

Here’s some example code I managed to throw together, using my example above:

require 'lanes'

function sqr()
    print(5*5)
end

function middleman()
    sqr()
end

gen = lanes.gen({globals = _G}, middleman)

print(gen()[1])

Produces an error saying:

tc@box:~$ lua lanestrouble.lua 
lua: lanestrouble.lua:4: attempt to call global 'print' (a nil value)
stack traceback:
        [C]: in function 'error'
        ./lanes.lua:190: in function <./lanes.lua:136>
        lanestrouble.lua:13: in main chunk
        [C]: ?
threading.c 399: pthread_cond_destroy(ref) failed, 16 EBUSY
Aborted
tc@box:~$ 

(By the way, I’m using linux)

However, if you change line 11 from gen = lanes.gen({globals = _G}, middleman) to gen = lanes.gen({globals = _G}, sqr), it works fine.

I’ve checked, and the same thing happens if you pass “*” (or any other option for the “libs_str” parameter) to load the default libraries.

I really wish there was something like Java’s threading library for Lua, that’s how I originally learned to use threads. (I know, not the most ideal environment I suppose)

Thanks, I appreciate help a lot. Especially since this has completely halted my IRC bot development! 🙁

  • 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-22T21:44:51+00:00Added an answer on May 22, 2026 at 9:44 pm

    Making sqr local does the trick. Since it becomes an upvalue of middleman, it is copied to the new lane.

    require 'lanes'
    
    local function sqr()
        print(5*5)
    end
    
    function middleman()
        sqr()
    end
    
    gen = lanes.gen({globals = _G}, middleman)
    
    print(gen()[1])
    

    But definitely something strange is going on. I mean, even when passing explictly “sqr” and “print” to the new lane, it won’t see “print” (when called by “sqr”). It seems to me that something is not working right when serializing functions between lanes. You should contact its maintainer.

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

Sidebar

Related Questions

hope you're having a good day. Another socket issue, another day :) I finally
Hope you're having a good Friday and stuff... okay, so here's my question: All
I hope this is programmer-related question. I'm in the hobby business of C# programming.
Hope I'm asking this correctly: I have a project Projects.Client I have my class
hope you can help me. I have html markup like this: <a href=error.htm class=button
Hope my question makes sense: Programming in C, can I create a hash table
Hope someone can help me I have declared the variable <?php $sitename = http://
Hope you can have a quick look at what I'm doing here. Essentially, am
Hope somebody can help me. I am just learning C# and I have a
Hope anyone can shed light on this so I can use pens with dash

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.