lua-users home
lua-l archive

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


On Fri, Jul 10, 2009 at 12:22 PM, <abdul.shaik@wipro.com> wrote:
> I am not able to understand the behavior for the following lua code.  I
> am expecting
> The portcardlog () function needs to be called for each pair in
> slot_tbl, but that was
> not happening.  The portcardlog() function will be calling only once and
> that's it.
> Can anybody clarify this behavior.
>
>
>         for k,v in pairs(slot_tbl) do
>                portcardlog(k,v)
>         end
>
> slot_tbl = { 1="ONE",2="TWO"...}

You will need to provide us with a bit more context.  As you can see
with a normal function like 'print', the code operates as expected:

> slot_tbl = {"ONE", "TWO", "THREE"}
> for k,v in pairs(slot_tbl) do
>>   print(k, v)
>> end
1	ONE
2	TWO
3	THREE

What could be happening is that the portcardlog function is erroring,
causing whatever the overall handler is to exit.  For example:

> function exitfunc(...)
>> print(...)
>> os.exit()
>> end
> slot_tbl = {"ONE", "TWO", "THREE"}
> for k,v in pairs(slot_tbl) do
>> exitfunc(k, v)
>> end
1	ONE

Please give us some more information, if you can.

- Jim