Harro,
So I was working on my LUA wrapper last night and have hit a bump. Despite to extensive resources found via search, I am still having issues returning results with ToString.
I am executing all my Lua in WoW's main thread via an EndScene hook, so scope isn't the issue. It appears that I have not understood the concept of FrameScript_Execute [0x007F25C0] entirely, I believe a majority of people label this as DoString....
Anyways in dodgy pseudocode if I were to call in WoW's main thread:
Anyways lets assume I were to call the luaCommand UnitGUID("unit") where unit is some unit in my vicinity. Below is some dodgy psuedocode I would call the following. Please assume all the functions have been hooked appropriately with the offsets mentioned below. Also assume function typedefs have been correctly declared as Bobbysings WoWX Base.
What I would like to know is, should ToString() return a char * to the result returned by UnitGUID("unit")? Or is UnitGUID("unit") not pushing the GUID string to the luaStack?Code://Offsets //GetState = 0x7F1160; //GetTop = 0x826D80; //ToString = 0x827290; //FrameScript_Execute = 0x007F25C0; FrameScript_Execute(luaCommand, 0, GetState()); int n = GetTop(GetState()); ToString(GetState(), n, 0);
Now I have seen Apoc post that he simply calls DoString -> GetTop -> ToLString. I must be missing something though.
One thing I notice is GetTop() always returns 0 for me (even after calling DoString numerous times), indicating the stack size has not increased at all.
I really do not want to use GetLocalizedText, Cypher has given many good reasons as to why. Although my Bot is not public or commercial (I only share it with close friends), I still do not wish to use the GetLocalizedText method.
ISXWoW's method of grabbing values elludes me right now, is it entirely necessary to register your own Lua Function in order to return results?
I'm open to any suggestions to get the DoString -> GetTop -> ToLString method working.