how to access funcs in other lua states?

roughboy

Chieftain
Joined
Oct 31, 2010
Messages
5
i would like to access the file system functions of the os object from Lua. in the Fire Tuner i can select the "Main State" context and these functions work fine. However, i have no idea how to access them from my own mod's context... for example how do I call os.rename() from within my mod's context/state? it reports it as a nil object from any context but the Main State.

thanks!
 
As far as I can tell lua is crippled in mod context. I have a similar problem as I want to be able to load a socket module to build an in game chat client. Looks like it is impossible until we get the C++ SDK. makes me wish for the good ol days in civ iv with python!
 
firaxis blocked out a lot of that stuff. if not, a lua script (that can be published on the steam mod hub) could install a trojan for example
 
i was afraid that was the case. thanks for the reply.

Can we expect this (that is, the access of broader Lua or system-level functionality) to be possible with the C++/dll sdk? I am new to Civ modding (but not to modding or coding) and do not know the capabilities of dll level modding in Civilization games.

i am simply trying to communicate with an external program. i have a functioning system using ModUserData Sqlite, but what i'm doing would be cleaner with simple file access (opening a socket would be even better, but i have little hope of such capabilities if i cannot even open a file).

thanks for any info.

edit: croxis, missed your post -- so sounds like we will be able to do it all with the C++ sdk? i'm willing to wait... but moving my project back to civ4 is tempting too. socket modules no problem with python in civ4, then?
 
well if its true that we the source is going to be released then i dont see how there's nothing we wont be able to allow. i didnt play civ4 long enough to see how it was to use their dll stuff so im just guessing here
 
Civ IV had the python standard library (as far as I remember). Using sockets or moving files is as simple as import os, import socket.

The C++ SDK should expose everything needed to have fully featured lua. In Civ IV it gave access to everything except netcode and graphics.
 
smellymummy really hit it on the head. It's a computer security and company liability issue. But with open dlls, anything is possible and users beware, ie: Steal Credit Card Data (v.1), uploaded by: Ru$$ianKid.
 
Back
Top Bottom