Using Lua libraries from within tup

162 views Asked by At

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

1

There are 1 answers

2
Paul Kulchenko On BEST ANSWER

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".