[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Global modification policy in Penlight
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 30 Apr 2013 14:06:14 +0200
2013/4/30 Thijs Schreijer <thijs@thijsschreijer.nl>:
> PS. A good utility function to detect the runtime would be nice
> (5.1, 5.2, LuaJit 1/2, any others?), to circumvent the issue mentioned
> by Dirk (checking on getfenv)
The start of string.dump(load"") contains a fingerprint.
…/var$ lua5.1
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> return string.dump(loadstring""):sub(2,4)
Lua
> return math.floor(string.dump(loadstring""):sub(5,5):byte()/16)
5
> return string.dump(loadstring""):sub(5,5):byte()%16
1
>
…/var$ lua
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> return string.dump(loadstring""):sub(2,4)
Lua
> return math.floor(string.dump(loadstring""):sub(5,5):byte()/16)
5
> return string.dump(loadstring""):sub(5,5):byte()%16
2
>
…/var$ luajit
LuaJIT 2.0.0 -- Copyright (C) 2005-2012 Mike Pall. http://luajit.org/
JIT: ON CMOV SSE2 SSE3 fold cse dce fwd dse narrow loop abc sink fuse
> return string.dump(loadstring""):sub(2,3)
LJ
>