Search found 34 matches

by vortizee
Sun Aug 21, 2016 9:16 am
Forum: General
Topic: Resuscitating Lua couroutines
Replies: 7
Views: 4340

Re: Resuscitating Lua couroutines

After minor refinements and typo safaris, the coroutines are now immortal !! Speed is not much better than the virtual coroutines, but the controller is back to a few lines of code. Caching a function that is part of a local table of functions failed, as did caching a similar from an include/require...
by vortizee
Sun Aug 21, 2016 8:28 am
Forum: General
Topic: Simple sort of table array
Replies: 16
Views: 9978

Re: Simple sort of table array

Then I learned something, thanks!
by vortizee
Sat Aug 20, 2016 10:41 pm
Forum: General
Topic: Resuscitating Lua couroutines
Replies: 7
Views: 4340

Re: Resuscitating Lua couroutines

Let me try to answer in sequence as I’m struggling with the limited size of the forum pages. No, there are multiple databases to poll sequentially so it’s efficient to call any of them in one coroutine statement by index. As in coroutine.resume(getPieces ) dbase_last is a global localized to a table...
by vortizee
Sat Aug 20, 2016 9:02 pm
Forum: General
Topic: Simple sort of table array
Replies: 16
Views: 9978

Re: Simple sort of table array

zorg wrote: When called, table.sort internally calls that sorting function with elements from pcs.A; whether it’s consecutive in order or not, i don't know and frankly don't care, the point is it should sort the table. I’m just trying to understand how it works so I can write other sorting function...
by vortizee
Sat Aug 20, 2016 8:10 pm
Forum: General
Topic: Resuscitating Lua couroutines
Replies: 7
Views: 4340

Re: Resuscitating Lua couroutines

Eternal is not as trivial as I thought, so I paused to think it over and came up with the below after abandoning hasty thoughts of multiple yields or potential resume dead ends. local coroutineThatLives[coNum] = coroutine.create( function ( ) local count, start, prev, last = 0, 1, 1, dbase_last whil...
by vortizee
Sat Aug 20, 2016 3:26 pm
Forum: General
Topic: Simple sort of table array
Replies: 16
Views: 9978

Re: Simple sort of table array

Okay, thanks for the explanations. I’ve read them twice. I’ll need to read them a number of times more (lol — really!). Because I still don’t understand why the sort knows that ‘a' refers to { pcs.A[1][1], pcs.A[1][2] } and ‘b' to { pcs.A[2][1], pcs.A[2][2] }, and not, say, pcs.A[1][3], pcs.A[2][3]....
by vortizee
Sat Aug 20, 2016 2:39 pm
Forum: General
Topic: Resuscitating Lua couroutines
Replies: 7
Views: 4340

Re: Resuscitating Lua couroutines

What Inny says is beyond my level of understanding abstractions. But a coroutine that never dies needs to reset its starting point locals somehow. This sounds intuitively reasonable. There’s a script-wide local keeping track of which coroutine# in the array of coroutines is active, so any coroutine ...
by vortizee
Fri Aug 19, 2016 7:28 pm
Forum: General
Topic: Resuscitating Lua couroutines
Replies: 7
Views: 4340

Resuscitating Lua couroutines

I had an array of coroutines, which in my naïve way I created to parse database files (300,000 lines) of object information to be drawn. They ran without any attention, filling a temporary table until the parse was complete, at which time I could seamlessly replace the live table with the temp table...
by vortizee
Fri Aug 19, 2016 4:52 pm
Forum: General
Topic: Simple sort of table array
Replies: 16
Views: 9978

Re: Simple sort of table array

Bingo! And bingo! Worked like a charm first time. I wrote a dozen other functions intuitively that error’ed out because I couldn’t (and can’t) figure out how the interpreter links a and b to the array. Thanks.
by vortizee
Fri Aug 19, 2016 4:38 pm
Forum: General
Topic: Simple sort of table array
Replies: 16
Views: 9978

Re: Simple sort of table array

Something like that, yes. But how does the function know what a[1] a[2] are? That’s what doesn’t penetrate my sclerotic brain.