Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleJOTFORMClient creates the adapter framework using a metatable

JOTFORMclient creates the Slack Jotform adapter framework.

JOTFORMgetSubmission and JOTFORMcustom modules are defined in a metatable as methods and set to the S object. The API key passed to JOTFORMclient is assigned to the new S table so that it can be used by the methods. If the API key is not passed, a “Missing key“ error is thrown.

Code Block
languagelua
local MT={}

MT.__index = {}
MT.__index.custom  = require 'JOTFORM.JOTFORMcustom'
MT.__index.getSubmission = require 'JOTFORM.JOTFORMgetSubmission'

help.map{dir='JOTFORM/help',methods=MT.__index}

function JOTFORMclient(T)
   if T.key == '' or T.key == nil then error('Missing key',2) end
   local S= {}
   setmetatable(S, MT)
   S.key = T.key
   return S
end

Concepts used:

...