complicated local defining and making adjustable tables

complicated local defining and making adjustable tables

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
bobthedinosaur
Blood & Steel Developer
Posts: 2702
Joined: 25 Aug 2004, 13:31

complicated local defining and making adjustable tables

Post by bobthedinosaur »

What I am trying to do is get some modoption sliders to adjust categories of units that are somewhat randomly spawned according to their weights. My current method spring dislikes, since my local defining on line 13 with the square brackets is bork. Spring also doen't like using that ugly name definition with the square brackets in the table's since I am trying to modify the tables with a simple name, later on..

Any suggestions from the savvy trick up their sleeve coders?
Last edited by bobthedinosaur on 01 Apr 2011, 15:05, edited 1 time in total.
User avatar
jK
Spring Developer
Posts: 2299
Joined: 28 Jun 2007, 07:30

Re: complicated local defining and making adjustable tables

Post by jK »

1. use pastebin!
2. list of most obvious lua syntax errors:

remove the outer [] (why did you added them?)

Code: Select all

local crate = [ UnitDefNames['crate'].id ]
note an error still `bad style`

Code: Select all

local gear = {}
gear = {...}
why the "if" at the front?

Code: Select all

if wdef = ( tonumber(Spring.GetModOptions().geardef) or 0 )
Post Reply

Return to “Lua Scripts”