Matrix Games Forums

Forums  Register  Login  Photo Gallery  Member List  Search  Calendars  FAQ 

My Profile  Inbox  Address Book  My Subscription  My Forums  Log Out

LUA frustration! Help needed!

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> LUA frustration! Help needed! Page: [1]
Login
Message << Older Topic   Newer Topic >>
LUA frustration! Help needed! - 6/3/2017 11:45:33 AM   
MasterStomper

 

Posts: 4
Joined: 6/3/2017
Status: offline
Hello!

I´m working on a big scenarion which includes forward basing of USN and USAF fighters at allied airfields. I´m trying (to no avail) to use the new ScenEdit_FillMagsForLoadout script to have the bases magazines armed with the relevant loadouts. However i try i keep getting error messages like below:

ScenEdit_FillMagsForLoadout('{unit='RAF Lakenheath', loadoutid=4795, quantity=12}') (trying to load F-22 loadouts to RAF Lakenheath, mission trigger is a C-5 galaxy landing there)

Keep getting this error message:

"Lua script execution error: [string "test"]:1: `)`expected near `RAF`"

I´m sure its got something to do with my syntaxing but i´ve tried variations ad nauseam.

Any input?

MasterStomper


Post #: 1
RE: LUA frustration! Help needed! - 6/3/2017 12:06:42 PM   
User2

 

Posts: 118
Joined: 1/14/2016
Status: offline
Never tried to write lua scripts in this game. But here is my guess:
String shenanigans issue. How do you think lua interpreter should understand that second ' is the start of another string, not the end of the first one? Try using "" in ''

(in reply to MasterStomper)
Post #: 2
RE: LUA frustration! Help needed! - 6/3/2017 12:12:38 PM   
MasterStomper

 

Posts: 4
Joined: 6/3/2017
Status: offline
Thx for help, not an avid coder as you see. How would you type that string then?

ScenEdit_FillMagsForLoadout('{unit="RAF Lakenheath", loadoutid=4795, quantity=12}')

?

thx

(in reply to User2)
Post #: 3
RE: LUA frustration! Help needed! - 6/3/2017 12:41:13 PM   
User2

 

Posts: 118
Joined: 1/14/2016
Status: offline
I would have tried all the variants I could.

ScenEdit_FillMagsForLoadout('{unit="RAF Lakenheath", loadoutid=4795, quantity=12}')
and
ScenEdit_FillMagsForLoadout("{unit='RAF Lakenheath', loadoutid=4795, quantity=12}")
and
ScenEdit_FillMagsForLoadout('{unit=\'RAF Lakenheath\', loadoutid=4795, quantity=12}')
and
ScenEdit_FillMagsForLoadout("{unit=\"RAF Lakenheath\", loadoutid=4795, quantity=12}")

(in reply to MasterStomper)
Post #: 4
RE: LUA frustration! Help needed! - 6/3/2017 12:54:13 PM   
MasterStomper

 

Posts: 4
Joined: 6/3/2017
Status: offline
alternatives:

1: Lua script execution error: [string "test"]:1:invalid arguments to method call

2: Same

3: Same

4: Same

Funny. New error msg...

(in reply to User2)
Post #: 5
RE: LUA frustration! Help needed! - 6/3/2017 1:02:53 PM   
Owllord


Posts: 96
Joined: 7/15/2014
From: Tokyo, Japan
Status: offline
Did you try:

ScenEdit_FillMagsForLoadout({unit="RAF Lakenheath", loadoutid=4795, quantity=12})?

(in reply to MasterStomper)
Post #: 6
RE: LUA frustration! Help needed! - 6/3/2017 1:48:10 PM   
MasterStomper

 

Posts: 4
Joined: 6/3/2017
Status: offline
That worked Owl!

What did i do wrong?

Stomp

(in reply to Owllord)
Post #: 7
RE: LUA frustration! Help needed! - 6/3/2017 2:44:36 PM   
Owllord


Posts: 96
Joined: 7/15/2014
From: Tokyo, Japan
Status: offline
Hi MasterStomper,

Great to hear it worked! :)
You don't need ' around tables in LUA scripts, just the values in {} separated by , will do the trick!

(in reply to MasterStomper)
Post #: 8
RE: LUA frustration! Help needed! - 6/5/2017 12:08:51 PM   
Primarchx


Posts: 3102
Joined: 1/20/2013
Status: offline
Lua syntax is a bit strange for me coming from the C world.

(in reply to Owllord)
Post #: 9
Page:   [1]
All Forums >> [New Releases from Matrix Games] >> Command: Modern Operations series >> LUA frustration! Help needed! Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.906