lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi      
   I recently  encounter a strange problem: after the program run a long
time, it throw a "attempt to call a nil value" error. I provide a
interface file to the others, they call the Lua api to do some jobs, the
file i provided is like this:
        --intf.lua: interface provided by the FW
        function spt_doAjob()
                return SMF_DoAJob()
        end
        
SMF_DoAJob is also a Lua function, which does a few jobs and then calls
yield to make the coroutine waiting, and it also calls a function
written in C. The others call the spt_doAjob function in there script,
like:
        function sf_act()
                xxx
                spt_doAjob()
                xxx
        end
        
but this runs into error after the program runs a long time, it reports
message like "attempt to call a nil value:spt_doAjob". When it happens,
if i change the sf_act() function to the following, it runs right.
        function sf_act()
                xxx
                SMF_DoAJob()
                xxx
        end
        
This happens randomly, and i don't find in what condition it will
happen. Any advice given is appreciated.