webultra posted a method of using Lua Lanes with the AMS functions and it does this by passing _G to the lane so the lane, should, have everything on the stack but if you create some functions that use MemoryEx then the functions fail within the lane, other plugins such as Wow64 and ListBoxEx and ListIcon work just fine with passing _G but some objects such as the Paragraph fail but they don't fail as in a crash like MemoryEx they just don't do anything.
Putting the function locally within the lane like so
fails also and the error via pcall is:
1097 is not the lines the code is on and StatusBar.Handle is successfully passed to the lane via _G and the SetText function works without issue outside the lane so does anyone know how to pass MemoryEx over to the lanes?
Putting the function locally within the lane like so
Code:
[COLOR="#0000FF"]local[/COLOR] SetText [COLOR="#FF0000"]=[/COLOR] [COLOR="#0000FF"]function[/COLOR](Txt) [COLOR="#0000FF"]local[/COLOR] t [COLOR="#FF0000"]=[/COLOR] MemoryEx[COLOR="#FF0000"].[/COLOR]Allocate(String[COLOR="#FF0000"].[/COLOR]Length(Txt) + [COLOR="#000000"]1[/COLOR]) MemoryEx[COLOR="#FF0000"].[/COLOR]String(t[COLOR="#FF0000"],[/COLOR] -[COLOR="#000000"]1[/COLOR][COLOR="#FF0000"],[/COLOR] MEMEX_ASCII[COLOR="#FF0000"],[/COLOR] Txt) [COLOR="#0000FF"]local[/COLOR] y [COLOR="#FF0000"]=[/COLOR] Bitwise[COLOR="#FF0000"].[/COLOR]Or(Bitwise[COLOR="#FF0000"].[/COLOR]ASL([COLOR="#000000"]0[/COLOR][COLOR="#FF0000"],[/COLOR][COLOR="#000000"]16[/COLOR])[COLOR="#FF0000"],[/COLOR][COLOR="#000000"]0[/COLOR]) [COLOR="#0000FF"]local[/COLOR] x [COLOR="#FF0000"]=[/COLOR] Bitwise[COLOR="#FF0000"].[/COLOR]Or(Bitwise[COLOR="#FF0000"].[/COLOR]ASL([COLOR="#000000"]0[/COLOR][COLOR="#FF0000"],[/COLOR][COLOR="#000000"]16[/COLOR])[COLOR="#FF0000"],[/COLOR]y) [COLOR="#0000FF"]if[/COLOR] User32[COLOR="#FF0000"].[/COLOR]SendMessageA(StatusBar[COLOR="#FF0000"].[/COLOR]Handle[COLOR="#FF0000"],[/COLOR]0x401[COLOR="#FF0000"],[/COLOR]x[COLOR="#FF0000"],[/COLOR]t) [COLOR="#FF0000"]==[/COLOR] [COLOR="#000000"]0[/COLOR] [COLOR="#0000FF"]then[/COLOR] MemoryEx[COLOR="#FF0000"].[/COLOR]Free(t) [COLOR="#0000FF"]return[/COLOR] [COLOR="#0000FF"]false[/COLOR][COLOR="#FF0000"],[/COLOR] [COLOR="#800080"]"Can't set text"[/COLOR] [COLOR="#0000FF"]else[/COLOR] MemoryEx[COLOR="#FF0000"].[/COLOR]Free(t) [COLOR="#0000FF"]return[/COLOR] [COLOR="#0000FF"]true[/COLOR][COLOR="#FF0000"],[/COLOR] [COLOR="#800080"]"OK"[/COLOR] [COLOR="#0000FF"]end[/COLOR] [COLOR="#0000FF"]end[/COLOR];
Code:
[B][string "MXO"]:1097: attempt to call global 'type' (a nil value)[/B]
Comment