DevilXD Posted April 30, 2014 Share Posted April 30, 2014 (edited) Hello everyone,I am maker of "Equivalent Exchange v2 (RoG Compatible)" mod, and I am asking you guys, how can I solve this problem... My mod: [link]My mod is about exchanging one items into another... Each item has it's own EMC value, which tells us, how much "EMC energy" is "inside" of the item... All "Assigning EMC values to item" stuff is written in "EMCvals.lua" (see the attachment)...So, my "EMCvals.lua" is doing it's best, to keep all items in game have EMC values... I wanted to make this system as much flexible as possible... Here is where my problem starts:Basically, I need turfs names... I know, I can have a table with all turfs names stored and process it... But system must be flexible, so when Klei wanted to add a new kind of turf, it will assign EMC value to it automatically... The only way to do it, is to "extract" that names from inside "turfs" prefab... The thing is, this file returns unpacked table ( unpack(prefabs) ), and I don't know how to process this stuff in order to get these names... After three days of pointless work, I passed out...Can anyone help me figure out how I can do it ?PS.: My worthless function is in 50 line, inside "EMCvals.lua"...EMCvals.zip Edited April 30, 2014 by DevilXD Link to comment https://forums.kleientertainment.com/forums/topic/35670-big-coding-problem/ Share on other sites More sharing options...
squeek Posted April 30, 2014 Share Posted April 30, 2014 (edited) require can only ever return 1 result (I only just now learned that ). To get all of the return values of the prefab file, you could instead use the method that LoadPrefab uses:local turfs_fn = GLOBAL.loadfile("prefabs/turfs.lua")if type(turfs_fn) == "function" then local turfs = { turfs_fn() } if turfs then for i,turf in ipairs(turfs) do print(turf.name) end endend Edited April 30, 2014 by squeek Link to comment https://forums.kleientertainment.com/forums/topic/35670-big-coding-problem/#findComment-465408 Share on other sites More sharing options...
DevilXD Posted April 30, 2014 Author Share Posted April 30, 2014 Thank you soo much @squeek for this It's like, 10 lines of code, which was a real PAIN for me... A big Link to comment https://forums.kleientertainment.com/forums/topic/35670-big-coding-problem/#findComment-465525 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