[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: 5.2 and older compatibility
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 23 Sep 2011 10:36:49 -0300
> It seems as though this would work to make scripts compatible with
> version 5.2 and preceding versions. I had thought that making a require
> statement conditional was not supported.
> if _VERSION == "Lua 5.2" then
> mm = require"mm"
That depends entirely on what mm returns if anything. If mm is happy to
set the global mm but not return it then it won't work. I guess it's
safer to do something like this:
if _G[x]==nil then _G[x]=v end