I have a lua script which is run using the command line interpreter, the script needs to load a table from a file. The table is stored like this:
create_object_action = {
reflexive = true,
which_base_type = 29,
how_many_min = 1,
how_many_range = 0,
velocity_relative = false,
direction_relative = true,
random_distance = 0
}
How can I load the data in the table into the global namespace?
To run a Lua scriptOpen the Lua Script Library through Prepare > Run Lua Script. Use the appearing dialog to load, save, and execute Lua scripts as well as to create new ones. Select the script to be run. Click Execute Script.
If one script needs to explicitly call a function in another script, you can use Lua modules. Modules are scripts that return some value and allow other scripts to access that value.
dofile "mytables.lua"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With