Thursday, August 1, 2013

Lua angst

Tonight I needed to use the Lua interpreter (mostly I run from Love) and it seems that Lua for Windows hadn't set an inadequate path when it installed.

The environment variable LUA_PATH in the control panel was just "C:\Program Files\lua\5.1\lua" but this means the Lua interpreter won't be able to load modules in the current directory when used interactively.

I had to prefix the path with "?;?.lua" - i.e. "?;?.lua;C:\Program Files\Lua\5.1\lua"

Question mark is the wildcard for Lua, the interpreter swaps it for the module name. Semicolon is the "path" separator, though apparently Lua doesn't have much of a notion of paths.


I couldn't find mention of this problem through various frustrated web searches, so I'm posting it here. I expect all Lua coders already know that the LUA_PATH should include "?;?.lua".


Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.