Time Nick Message 18:52 w_laenger hi 18:54 w_laenger http://pastebin.com/bnXjK6vd 18:55 w_laenger I need to know a faster way to find out if a table is empty 18:55 w_laenger faster than in line 37 18:58 rubenwardy #tab == 0 18:58 rubenwardy # gets the length 18:58 w_laenger thanks 18:59 ShadowNinja Um, what is that? 18:59 w_laenger some code 18:59 rubenwardy lol 18:59 rubenwardy Looks like a technic cleaner 18:59 ShadowNinja What does it do? Cache nodes? 18:59 w_laenger You can store nodes into a table 19:00 w_laenger and their positions 19:00 ShadowNinja That doesn't look like something that would be accepted into technic... 19:00 ShadowNinja Why would you do that? Can't you just use the map? 19:01 w_laenger for long cables abms doesn't work in unloaded chunks 19:02 ShadowNinja You mean this would store the positions of technic machines for the switching station to check? 19:03 w_laenger no 19:03 w_laenger http://stackoverflow.com/questions/1252539/most-efficient-way-to-determine-if-a-lua-table-is-empty-contains-no-entries 19:03 w_laenger I think it would add the ability to transport power on cables through unloaded chunks 19:03 rubenwardy oh yeah, # won't work on hashed tables 19:04 rubenwardy but you are not using a hashed table, so # will work 19:04 w_laenger ok 19:05 rubenwardy just use next() 19:05 w_laenger ok 19:06 ShadowNinja That won't work, as you have to load the meta, which is stored in the block. And you need to access nodes to generate power with the geothermal generator and the like. 19:07 ShadowNinja minetest.forceload_block would work, but you don't want to over-use that. A world loader node would be usefull. 19:08 w_laenger but if one person waits at the first technic station and the other one at the second one 19:09 w_laenger and there's a small cable in unloaded chunks betwen them 19:09 w_laenger between* 19:09 w_laenger it could work 19:10 ShadowNinja Yes, but that's a unlikely scenario. Usually there will only be one player near a technic setup. 19:11 rubenwardy You could override Minetest.get_meta_data to return your own interface if it is your node. I dont recommend it 19:11 rubenwardy (And store the stuff in your file) 19:12 rubenwardy like get_meta_data = function(pos) if not my node then return real_meta(pos); else load from your file; end 19:14 w_laenger I think this could increase the lag 19:15 rubenwardy yeah 19:15 rubenwardy The main laggy bit would be checking if the node is stored by your file 19:16 rubenwardy or you could check whether the node should be stored by your file according to it's name 19:16 w_laenger but storing simple meta into a table (like energy) instead of writing it into the node's meta could decrease lag 19:17 rubenwardy https://gist.github.com/rubenwardy/b28e96d948cc65f4112a 19:17 w_laenger you could also don't use files 19:18 rubenwardy oh 19:18 rubenwardy What if the node meta included an inventory 19:18 rubenwardy ? 19:18 rubenwardy Problemo 19:19 w_laenger you could use an abm (ca. 10s) to store the info of the table into the wire's meta 19:20 w_laenger and use the table just for fast energy transfer 19:22 w_laenger you just use the table for the current electricity at the positions of wires 19:23 w_laenger so the table instead of the meta of the wires transports the e- 19:24 w_laenger you could also make some lag and put an invisible object at the energy's position for every e-