Code: Select all
--block_normal.lua
block_normal = {
name = 'block_normal',
w = 36,
h = 36,
collision = 'normal',
color = 'cyan',
states = {
idle = {
outline = 'black',
linewidth = 1,
color = 'cyan', --arbitrary redundancy, btw, to test my backend system
{'LG_RECT','A',0},
},
}
}
Code: Select all
--lolol spaghetti file structure
map.actorblocks = {
require 'engine.actorprop.blocks.block_normal',
require 'engine.actorprop.blocks.block_cling',
require 'engine.actorprop.blocks.block_greenheal',
require 'engine.actorprop.blocks.block_lava',
require 'engine.actorprop.blocks.block_bouncy',
}
Without making the individual files more complex, how could I store simple tables (e.g. without a load() function for each one) externally and then pull them into the program? Eventually this will become a modding API which is why I'm trying to figure out at least part of this simple implementation for now. I did try return = {codestuff} but it did the same thing so I'm guessing require is the wrong way to go about this? If dofile() is the right way to go how in the heck do I find the syntax for it, because the lua API isn't clarifying how to use it?
I'm mortified to attach a .love, because it is a huge mess of mostly-working code with entities designed with a variety of paradigms as I kept changing my mind, and this particular attempt represents a massive refactor I'm undertaking. Hopefully this is an abstract enough question, though.