multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.42k stars 438 forks source link

Calling non-existent exported functions throws extra errors #427

Closed CrosRoad95 closed 6 years ago

CrosRoad95 commented 6 years ago

Describe the bug Sometimes if something wrong, there is displayed error: attempt to call a nil value, but without script, file, or line, just [ERROR] attempt to call a nil value

To Reproduce i don't know how reproduce it, it appear client, and server side

Expected behavior Next to message should be source of error.

Screenshots image ^ lastest error image

MTA Client (please complete the following information): Multi Theft Auto v1.5.6-release-14334

MTA Server (please complete the following information): MTA:SA Server v1.5.6-release-14334

This appear before 1.5.6, and currently still appear ( client and server )

Additional context

patrikjuvonen commented 6 years ago

It would help to know what script is causing this behavior so it is easier to debug.

ccw808 commented 6 years ago

What happens when you fix the blanked out errors?

ghost commented 6 years ago

Its reproduceable by creating 2 Resources

Resource 1: Add an exported function to meta.xml BUT dont declare it anywhere in lua Resource 2: Call that exported function from Resource 1 -> Error is thrown because the LuaVM is trying to call it.

An easy solution would be to check if that function exists in lua BEFORE adding it to the list (we would probably need some kind of checks somewhere - otherwise, throw loading script failed / show warning message)

https://github.com/multitheftauto/mtasa-blue/blob/37e9336afdc81850f6178e70cf8a72b07e274d95/Server/mods/deathmatch/logic/luadefs/CLuaResourceDefs.cpp#L1138

https://github.com/multitheftauto/mtasa-blue/blob/master/Client/mods/deathmatch/logic/CResource.cpp#L205

https://github.com/multitheftauto/mtasa-blue/blob/master/Server/mods/deathmatch/logic/CResource.cpp#L1732

qaisjp commented 6 years ago

Nice find @LuXorioN96.