Getting & Setting values for variables via EXEC.lua
I see how to run some scripting from exec.lua from a web page, (http://bridgesim.net/discussion/comment/1196/#Comment_1196) but I'm not able to set & get variable values from there. I could use some examples on how to do this as apparently I can't figure this out.
Here's what I want to be able to do:
Read a value from a known variable/array
Set a value from a known variable/array
Quick Example:
Create a web interface for keeping track of inventory in a cargo hold.
Create a web interface for Engineering for recalibrating reactor & engines
Here's what I want to be able to do:
Read a value from a known variable/array
Set a value from a known variable/array
Quick Example:
Create a web interface for keeping track of inventory in a cargo hold.
inventory["stembolts"]=1 -- Number of stembolts in inventory
Create a web interface for Engineering for recalibrating reactor & engines
calibration["reactors"]=3 -- if greater than 0, multiply it with heat to decrease efficiency
Comments
However, you can set any custom variable on a player ship:
Example, this script sets some custom properties on a station:
https://github.com/daid/EmptyEpsilon/blob/master/scripts/scenario_06_battlefield.lua#L12
Which are used by the station comm script later on:
https://github.com/daid/EmptyEpsilon/blob/master/scripts/comms_station.lua#L126
(As for having an actually inventory to manage. I'm thinking about different ways to do that. I'll make a new post about it)