aboutsummaryrefslogtreecommitdiff
path: root/examples/requirer.pd_lua
blob: 4b6c4e9b1ea90399de5555c89d1369f0ee62d145 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
complex = require("complex")
sqlite3 = require("luasql.sqlite3") -- evil hack, below is lame

local R = pd.Class:new():register("requirer")

function R:initialize(sel, atoms)
  if type(atoms[1]) ~= "string" then return false end
  -- require(atoms[1]) -- will this ever work?
  for k,v in pairs(_G[atoms[1]]) do
    pd.post(atoms[1].. "." .. tostring(k) .. " = " .. tostring(v))
  end
  self.inlets = 0
  self.outlets = 0
  return true
end