SRTT Lua functions

We actually have at least 2 separate lua states - one for gameplay and another for the interface.

Within a single lua state, you're able to invoke any of the currently defined functions. Currently defined being the key. We keep the lua footprint manageable by only loading the files that are currently needed. So, for example, we only load a single mission .lua file at a time.

I'm not as familiar with the interface side of things, but I would assume that the same thing is done there. So really, the answer is probably that your success is going to depend on which functions you are trying to call and the current game state.
 
thanks for the replies, however when I was talking about calling fuctions from a lua script in one that doesn't have them, to be more specific, I was talking about calling functions from other store lua script in store_crib.lua.

It seems like you didn't get your question completely answered, so I'm going to try and jump in here. :)

While it is possible to call a Lua function defined in one script from a different script, there are a few things that can prevent you from doing so.
1) The script containing the function you want to call is currently not loaded.
2) The script containing the function you want to call is loaded, but not in the same Lua state (SR games use two Lua states, one for Interface and one for Gameplay. In general it is not possible to make function calls across the two states).

Depending on the specifics of what you are wanting to do, it may be easiest to simply copy the function you want to call into the script you want to call it from.
 
Back
Top