hijack lua_State ... need some advice

07/01/2017 21:08 R3p#1
i grab game's original lua_State* from gettop or dostring it doesnt matter cause they are the same

but once i grabbed it and when i wanna use game's original state in lua api calls like "lua_pushstring"

it throws me access violation exceptions

"Unhandled exception at 0x00007FF8DF3F4EE5 (my.dll) in BlackDesert64.exe: 0xC0000005: Access violation reading location 0x0000000000000018."

which is inside luaS_new in this case but its not just inside that api call its in all api calls when i use games state

when i create a new state and use it everything works fine

mby someone out there knows something about. alrdy googled a lot but found nothing :)
07/03/2017 12:54 ShovelBox#2
Quote:
Originally Posted by R3p View Post
i grab game's original lua_State* from gettop or dostring it doesnt matter cause they are the same

but once i grabbed it and when i wanna use game's original state in lua api calls like "lua_pushstring"

it throws me access violation exceptions

"Unhandled exception at 0x00007FF8DF3F4EE5 (my.dll) in BlackDesert64.exe: 0xC0000005: Access violation reading location 0x0000000000000018."

which is inside luaS_new in this case but its not just inside that api call its in all api calls when i use games state

when i create a new state and use it everything works fine

mby someone out there knows something about. alrdy googled a lot but found nothing :)
It will never be stable if you continue to use it as lua_State*
You need totally same lua lib version as developers used.

Try to find another way to use it :)
07/04/2017 18:47 R3p#3
I know another way maybe but I thought it would work to use LuaIntf for example to bind some of my c++ functions to games lua context. LuaIntf requires a lua state where I passed the one from the game ofc