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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:15:45+00:00 2026-06-17T12:15:45+00:00

TLDR; My functions are not callable from the _G scope, and I want them

  • 0

TLDR; My functions are not callable from the _G scope, and I want them to be so I can call functions by parsing a list of strings. This could be exacerbated by a package.seeall required by the framework.

I am working in the luci framework, which is an UCI front end for OpenWRT routers. In an attempt to create customized functions that are called when specific UCI values are parsed I have created functions that share the name of the return value which are called through _G.

The parsed data looks something like this:

data = {Name="value"} 

I code looks like this:

function main()
    local pageValues={modules={}}
    for i,x in pairs(data) do
        --here is the part that throws the error
        pageValues.modules[x]=_G[x]()
        --also throws error when "newValue=_G[x]()
    end
end

function value()
--also does not work with "local function value()"
    return 'YEA'
end

The error I am getting returned to me is attempt to call field '?' (a nil value)
When I directly pass it the string “value” with pageValues.modules['value']=_G['value']()I receive attempt to call field 'value' (a nil value)
When is create a dummy variable as such

dummy = 'value'
pageValues.modules[dummy]=_G[dummy]()

I receive attempt to call field '?' (a nil value). This is the same if I use local dummy = 'value'

When I parse _G to see if any of my functions are in it I find that they are not. NOTE Luci automatically calls package.seeall, and I don’t know if that is what is messing with my global’s. But, it may be important in answering this question.

My most urgent need is to get this function running correctly. My secondary interest is in how I can determine the scope in Lua to be able to troubleshot sand-boxing issues in LuCI in the future.

  • 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-17T12:15:46+00:00Added an answer on June 17, 2026 at 12:15 pm

    Its a little hard to understand what is going on in your code, since its not a contained executable example, but one thing that could be happening is that, if the module you defined the globals has called the module function then whenever you try to set a global it will instead set a key in the module’s table. Additionally, if you run module with the package.seeall parameter then global assignments are still redirected – the only difference is that the module can read other predefined global variables.

    If this is the case, you would be able to solve your problem by either not trying to read the values from the global table (reading from the appropriate module instead) or by setting _G directly when creating those values in the first place.

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

Sidebar

Related Questions

TLDR; this is not a well-phrased question, so you should probably not bother with
I have this code: filename = tkFileDialog.askopenfilename(initialdir=lists/custom/, filetypes=((Word list, *.tldr), (All files, *.*))) If
NOTE: If you don't want to read this, check TLDR version at bottom of
Since I got TLDR (too long didn't read) comments, I stripped 90% of this
TLDR: Started with this question simplified it after got some of it working and
TLDR : I have an Openlayers map with a layer called 'track' I want
I have this query which I want to run in my PHP application back
TLDR: What can you do to combine multiple CoffeeScript files into one JS file,
TLDR : Can the onreadystatechange event be emulated somehow else for synchronous requests without
TLDR ; I need simple a Python call given a package name (e.g., 'make')

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.