Whew, lots of replies.
Quote:
if type(lines) == "string" then
lines = utils.split(lines, ",")
elseif type(lines) ~= "table" then
error("Invalid argument to EnableModule: " .. lines .. "\10")
end
-- lines should be a table at this point
The argument should come in as either a string or a table. If it's a string, I convert it to a table. I don't need to check that, because I know it's already a table. If it's not a string, it checks the elseif. If it's not a table already, I don't care what it is, it's wrong! ;)
Quote:
This is the END-OF-RECORD option.
Ah, thanks. Didn't particularly know what it was for or why I needed to watch for it in the packets, since I based this plugin off of another.
Quote:
BTW, \10 is the newline character, so it is more usual to use \n.
In any case I don't think you need it, error messages are not normally terminated by a newline, Lua adds that anyway.
I've had strange experiences with needing arbitrary amounts of slashes before the \n, and when I used \10 at some random point in time it worked, so it became a habit. Not technically the best way to start a habit, I suppose.
Anyways, I still haven't discovered why it's not working depending on how many times I've called OnPluginConnect. It only seems to work the first time I open the world and connect, which implies that something's up with my 'mods' table, and I'm printing the contents of 'mods' every time I connect, so nothing's off there... |