Dr_Cox1911 Posted December 19, 2016 Share Posted December 19, 2016 (edited) Greetings, kinda stuck with LuaNet and really need your help guys. I want to transfer an inventoryitem (basically a table) with LuaNet, but for some reason it doesn´t send the table as payload, instead I receive an empty table transmitted. So what I want to do in a nutshell: local player = getPlayer(); local inv = player:getInventory(); module.sendPlayer(getPlayer(),"senditem", inv); (Maybe @turbotutone might know what´s going on there) Edited December 20, 2016 by Dr_Cox1911 edited sendPlayer to reflect the proper parameter passing, specified title Link to comment Share on other sites More sharing options...
Dr_Cox1911 Posted December 20, 2016 Author Share Posted December 20, 2016 (edited) Seems like it doesn´t support sending the converted java object that reflects the inventory item. Currently working on a temporary solution by not sending the actual item, but instead all the info regarding that item. Think this is somehow possible with ModData, just need to find a way to populate the ModData of the item object with all the stats like condition, cooked, ... Sloppy way that I don´t want to do: Checking with "instanceof" which type of item it is and then getting all the info with the "get"-functions and populate the ModData. Downside to this approach: Whenever an item type like food gets a new info I need to alter my mod. Edited December 20, 2016 by Dr_Cox1911 Link to comment Share on other sites More sharing options...
EnigmaGrey Posted December 20, 2016 Share Posted December 20, 2016 Yes, finding out that ModData isn't automagically populated with variables within the class was pretty disappointing to find out. Problem is, reflection is off the table. If those variables aren't accessible via public functions, you won't be able to check them. (e.g. item:getCooked() returns boolean, thus t["isCooked"]=true). Link to comment Share on other sites More sharing options...
Dr_Cox1911 Posted December 20, 2016 Author Share Posted December 20, 2016 18 minutes ago, Butter Bot said: Yes, finding out that ModData isn't automagically populated with variables within the class was pretty disappointing to find out. Just curious, but is there a technical reason for this? There is a field and parameter called "DefaultModData", but this is also empty. Will sleep a night on this matter, but I think getting all the variables that have a get-function seems to be the only way Haven´t really checked if all necessary variables have those. Link to comment Share on other sites More sharing options...
EnigmaGrey Posted December 20, 2016 Share Posted December 20, 2016 That I do not know. I could only guess that'd it'd be a real pain to have every object duplicate itself in mod data. Rather limiting. Link to comment Share on other sites More sharing options...
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