AfuSensi Posted July 24, 2014 Share Posted July 24, 2014 Hi, I'm trying to call the function "getRunningGamemode" to detect what gamemode the current map is. But it returns userdata instead of the gamemode. I have no idea what userdata is. I use this to call the function: gamemode = call(getResourceFromName("mapmanager"), "getRunningGamemode") outputChatBox(tostring(gamemode)) Returns: userdata: 020000F5 https://wiki.multitheftauto.com/wiki/Map ... _functions Link to comment
Bonsai Posted July 24, 2014 Share Posted July 24, 2014 As its supposed to be. Now use getResourceName on that userdata. Link to comment
AfuSensi Posted July 24, 2014 Author Share Posted July 24, 2014 As its supposed to be.Now use getResourceName on that userdata. Thanks! It worked. Mind explaining what userdata is? I can find nothing on wiki about it. Link to comment
Bonsai Posted July 24, 2014 Share Posted July 24, 2014 It's some kind of representation of elements. Link to comment
Et-win Posted July 24, 2014 Share Posted July 24, 2014 With the userdata you can do things with other codes. Like getResourceName, getPlayerName, getTeamName, etc, etc. I don't really know how to explain that properly, but lets just say you can do something with it :3 Link to comment
RottenFlesh Posted July 24, 2014 Share Posted July 24, 2014 There are eight basic data types in Lua: nil, boolean, number, string, userdata, function, thread, and table. Userdata are used to represent new types created by MTA such as player, vehicle, objects or even xml nodes. That's the way you can represent those elements in lua, as they are not native of the language. Link to comment
cheez3d Posted July 24, 2014 Share Posted July 24, 2014 Userdatas are created using the C API of Lua. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now