views:

1057

answers:

4

Can anyone tell me where to find Lua's bytecode specification? I've been searching for 15 minutes, and I can't find anything.

+7  A: 

Maybe A No-Frills Introduction to Lua 5.1 VM Instructions contains what you're looking for?

There is also a table of the Lua 5.0 instruction set (Figure 5) in:

Ierusalimschy, R.; Figueiredo, L. H.; Celes, W. (2005), "The implementation of Lua 5.0", J. of Universal Comp. Sci. 11 (7): 1159-1176

You can find the full text with a search on Google Scholar and I believe it's on lua.org as well. This reference is used by the Lua page on Wikipedia, which is always a good place to look for such things. :-)

thsutton
+7  A: 

The official definition is in lopcodes.h.

lhf
+2  A: 

You can read The Implementation of Lua 5.0 online.

torus
Very interesting read as I've always wanted to know how it all works in some code-related details.
Nick Bedford
+2  A: 

The bytecode specification is purposefully not published. You shouldn't depend on the VM to retain compatibility between Lua versions (and especially not among various implementations). For academic curiosity's sake, see the other answers.

Cogwheel - Matthew Orlando