4

I'm using tup to replace a complicated Makefile and I'd like to call out to other Lua libraries from my tup code. In particular. I'd like to use luafilesystem and yaml to generate build rules. However, I can't find a way to load these libraries from within tup.

In particular, if I do

local lfs = require "luafilesystem"

(or any of the other traditional variants for importing Lua scripts), I invariably get this error:

attempt to call global 'require' (a nil value)

This suggests to me that tup does not support the usual Lua mechanisms for invoking exernal libraries. Am I missing something?

I'm using tup v0.7.3-4-g1a8d07e

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
Wicker
  • 43
  • 2

1 Answers1

1

According to the documentation require is not available: "The base functions are defined, excluding dofile, loadfile, load, and require."

It seems like you may be able to implement your own "require" based on tup.include, which "Parses and runs the Lua file at path".

Paul Kulchenko
  • 25,884
  • 3
  • 38
  • 56
  • That's true, but I'd really like to be able to require binary Lua libraries as well, which is not possible with `tup.include`. In fact, I'd really like a version of `tup` without the restrictions on the Lua library. – Wicker Nov 13 '14 at 06:01
  • I am not familiar with tup, but based on my reading of the documentation, this was done on purpose as they are using a modified interpreter, so probably can't guarantee compatibility with binary modules. – Paul Kulchenko Nov 13 '14 at 07:12