<?xml version="1.0" encoding="UTF-8"?>

<!-- Functions for use with the atcp.xml plugin by Soludra -->

<!DOCTYPE script>
<script>
<![CDATA[

idATCP = "7c08e2961c5e20e5bdbf7fc5"

-- (string)
-- (table {string})
EnableModuleATCP = function (module)
  modules = {}
  if type(module) == "string" then
    table.insert(modules, module)
  elseif type(module) == "table" then
    modules = module
  else
    error()
  end

  CallPlugin(idATCP, "EnableModule", table.concat(modules, ","))
end

SendATCP = function (msg)
  if type(msg) ~= "string" then
    error()
  end

  CallPlugin(idATCP, "SendATCP", msg)
end

UnpackATCP = function(atcp)
  if type(atcp) ~= "string" then
    error()
  end

  local sep = atcp:find("|")

  if sep then
    return atcp:sub(1, sep-1), atcp:sub(sep+1)
  else
    return nil
  end
end

]]>
</script>