- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
So suppose I have two separate Lua scripts, A and B.
Script A generates a series of item abilities and then stores their raw code ids in an array, call it IDS.
Script B generates a series of items whose item ability is based on the abilities generated in script A.
This means:
Which basically says that for each item in script B, there is a corresponding item ability in script A (or vice versa).
I would like to keep my code modular and separate item objects from abillity objects. Which means script A and script B are necessarily disjoint (different files).
Is there anyway I can "simulate" the code in script A and then somehow import the IDS array? When I say simulate, I mean perform the computations of the script without actually doing anything else (e.g. actually generating the objects).
My plan was to simply parse a script file and copy down its variables. But this doesn't work if the variable is not static (e.g. its final value changes over the computations of the script).
So if I can't import from a Lua object generation file, can I somehow do some I/O on its variables, e.g. print all the variables to some text file, which I can then read to do my pseudo-import?
So suppose I have two separate Lua scripts, A and B.
Script A generates a series of item abilities and then stores their raw code ids in an array, call it IDS.
Script B generates a series of items whose item ability is based on the abilities generated in script A.
This means:
Code:
for i = 0, TOTAL_ITEMS do
set items[i].itemAbility == IDS[i]
endfor
Which basically says that for each item in script B, there is a corresponding item ability in script A (or vice versa).
I would like to keep my code modular and separate item objects from abillity objects. Which means script A and script B are necessarily disjoint (different files).
Is there anyway I can "simulate" the code in script A and then somehow import the IDS array? When I say simulate, I mean perform the computations of the script without actually doing anything else (e.g. actually generating the objects).
My plan was to simply parse a script file and copy down its variables. But this doesn't work if the variable is not static (e.g. its final value changes over the computations of the script).
So if I can't import from a Lua object generation file, can I somehow do some I/O on its variables, e.g. print all the variables to some text file, which I can then read to do my pseudo-import?