View unanswered posts | View active topics It is currently Thu Dec 26, 2024 4:27 am



Reply to topic  [ 3 posts ] 
 load other data 
Author Message
Forum Moderator
User avatar

Joined: Fri Feb 02, 2007 3:53 pm
Posts: 1896
Location: in my little gay bunker
Reply with quote
Post load other data
What is the easiest way to load a bunch of data into my lua script? At the moment I have all my data at the start of my script and that certainly isn't optimal.


Sun Oct 14, 2012 10:49 am
Profile
Forum Moderator
User avatar

Joined: Fri Feb 02, 2007 3:53 pm
Posts: 1896
Location: in my little gay bunker
Reply with quote
Post Re: load other data
Oh yeah, should probably have specified that. From a file, is it possible to just ask lua to read lua from another file in the middle of the script? That would make it a whole lot easier to just strip the current data I have out and place it somewhere else, so that I don't have to parse it.


Sun Oct 14, 2012 2:00 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: load other data
It's not hard to call lua. Other stuff is probably more difficult, you use io.lines or some such, I don't really know anything about it.
But for lua you use:
Code:
dofile("folder.rte/filepath/script.lua");

You can also use require (not sure how the filepath works there) which I gather require is faster than dofile but limits the reloadability of the script (at least in the case of the ai).
With that you can call functions or variables defined in any lua file as if they were defined in this one. It's a great way to separate things into manageable chunks (e.g. my current scenario project has 7 separate lua files for the scenario so far).


Sun Oct 14, 2012 3:21 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.062s | 14 Queries | GZIP : Off ]