确定编译后的Lua的编译器版本 [英] Determine compiler version of compiled Lua

查看:74
本文介绍了确定编译后的Lua的编译器版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编译了LuaQ,我需要确定用于编译它的确切版本,这有什么可能的方式?

I have some compiled LuaQ and I need to determine exact version that was used to compile it, any possible way to do this?

推荐答案

已编译的脚本在文件开头具有标头.

Compiled scripts have a header at beginning of file.

4 bytes - signature ("\x1bLua")
1 byte - version (0x51)
1 byte - format
1 byte - endianness 
5 bytes - sizes of some types

因此您可以从第5个字节获取主要版本. 0x50适用于Lua 5.0.x,0x51适用于Lua 5.1.x,依此类推.
次版本(例如,区分5.1.3和5.1.4)在编译文件中不存在.

So you can get major version from 5th byte. 0x50 is for Lua 5.0.x, 0x51 is for Lua 5.1.x, etc.
Minor version (to differentiate 5.1.3 and 5.1.4 for example) is not present in compiled files.

这篇关于确定编译后的Lua的编译器版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆