Require file with variable rather than string?

Is it possible to require in a file using a string in a variable rather than a static string?

local nextView = "nextView" local view = require nextView

i  get weird “missing = after local”  errors with this code.

I’m trying create a more dynamic storyboardsystem where I just use two storyboard scene files that load each other when needed and load their contents dynamically by sending a variable to them with view content rather than repeat the standard storyboard functions (create, destroy, etc) in every file.

You are missing the brackets around the variable.

Do the following and it will work.

local nextView = "nextView" local view = require (nextView)

Greetings Torben

wow embarrassing. lots of examples leave them out though? require “physics” is common in the docs. so I thought that would work with variables too. :confused: why is that?

You are missing the brackets around the variable.

Do the following and it will work.

local nextView = "nextView" local view = require (nextView)

Greetings Torben

wow embarrassing. lots of examples leave them out though? require “physics” is common in the docs. so I thought that would work with variables too. :confused: why is that?