-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling GetCurrentTribe(0) can result in a CTD #8
Comments
Looks like either an allocation problem or some kind of overflow. Too bad it does not show the exact error message. The responsible source code in the lua lib is this (available online at lua.org):
luaM_reallocvector is just a wrapper for luaM_realloc, which calls the realloc function of bluebytes virtual machine.
Calling a function every frame may simply overload the lua vm. Maybe we should access the game structs ourselfs for simple functions like GetPlayerTribe. Edit: When you say "every frame", do you mean you call it from inside the frame hook procedure? That should not be allowed as GetPlayerTribe is a game logic operation. All game logic related functions must be called in the tick hook for synchronization purposes. |
I moved the call now in the first round tick and never call it again Question is, if the error is specific to the GetPlayerTribe function, or every lua funtion.
Oh, of course - yes, I used the tick proc to call GetPlayerTribe |
For interaction with the lua virtual machine we must use However most lua functions got an identical C-Function counterpart. Meaning these lua functions just delegate the call back to a C-function. For these functions we could simply skip the interaction with the lua vm and directly call the cfunc. Other functions require a little more conversion before calling the c functions. For example. Have a look at the implementation of ShowTextMessage. Instead of calling the lua function dbg.stm, I directly call the c function that is used by dbg.stm. Thus not executing any lua code. |
When calling
GetCurrentTribe(0)
every frame, there is a small chance, that S4 crashes.There is an exception thrown inside the luaD_checkstack() function:
The text was updated successfully, but these errors were encountered: