Fix math.frexp() and add more tests (thanks Florob, Link Mauve, xnyhps) default tip

Add math.frexp() and tests (many thanks to Florob and Link Mauve!)

Implement basic string.format() supporting %d/%s

baselib: Implement basic message-only error()

Implement string.find (mostly) and string.sub

Replace error reporting code with calls to LVM.traceback()

Add LVM.traceback() function

OP_SETLIST: Implement support for B==0 (to top of stack)

OP_RETURN: Pad out results with nils if we get less results than expected

OP_TAILCALL: Fall through to OP_CALL for native functions

OP_VARARG: Fix off-by-one

OP_GETUPVALUE: Clone original LValue

Create local function to use as chunk prototype

Better verification of function validity in LVM.call()

Indentation fix

Change LVM.call() to take an LValue rather than the raw native/LFunction object. Also add LVM.loadstring(chunk, env) and use that for loading luac.out.

Implement OP_TAILCALL - the last opcode!

Add a whole bunch of tests I've been using for recent additions

Adjust pc down by 1 when calculating error lines, pc is always the /next/ instruction

Remove some debugging in the gmatch function

Implement OP_VARARG

OP_RETURN: Shrink stack on return

OP_CALL: Don't push varargs into called function's stack

Fix OP_CONCAT: missing break; and should supply empty separator to join()

assert(): Throw "assertion failed" message when none supplied

"Implement" OP_CLOSE

Fix OP_FORLOOP to set the loop counter variable properly

Implement LValue.len() and OP_LEN (no metamethod yet)

Switch to [] for representing tables (for now)

Don't use this.LValue() inside the VM - it's for JS types only

Fix OP_CALL to handle the case of B==1 (no parameters) and fix an off-by-one error that wouldn't fill the stack with nils properly

Implement OP_MOD, OP_POW, OP_UNM, OP_NOT (no metamethods yet)

New (passing) test, arithmetic.lua

Implement OP_MUL (no metamethod yet)

Fix FORPREP to not blat R(A+3) - not sure what that line thought it was doing

Add unimplemented OP_* codes as reference

Fix exception in stack printing for some tests when debug mode is enabled

Prettier stack printing in debugMode

Fix traceback in error handling...

Add string lib, with gmatch function only for now

Implement OP_SETLIST

Implement OP_TFORLOOP

Implement OP_CONCAT (no metamethod yet)

Remove some debugging in math.ldexp() accidentally committed

Implement OP_DIV (no metamethod yet)

Don't try and print current position in the Lua script with no valid frame

Rename default_environment to _G, use registerLib() for baselib and add math lib with 2 ldexp, floor

Add LVM().registerLib(env, name, lib) to register a table of native functions to an environment.

Fix OP_SUB to use RK() too...

Update basic_logic test

Print out location at which errors occur, yay!

Pass sourceName to child chunks (in binary files it's only set in the top-level chunk)

Disable debugMode, accidentally committed

Implement OP_LE (no metamethod yet)

Fix OP_LT to respect A, and move OP_EQ to live next to it in the switch() for readability

Fix OP_LT to use RK()

Add assert() to baselib, real tests possible at last

Add LValue.truth() to return whether a value is (not(false) and not(nil))

Fix OP_SETTABLE to use RK() helper

Add 2 new pass tests, add.lua and bool.lua

Fix type() in baselib to return an LValue

Fix for passing arguments to the entry call frame

Implement OP_EQ

Give LValue an equals() method, returns true/false if the value == the first argument (checks metamethod)

Fix native function return values for the new calling interface

Update all opcodes to use RK() that need it

Add new RK() helper and fix OP_ADD to use it (so it loads constants properly)

Fix OP_ADD code to use new LValue format

Support for __add metamethod

New Lua<->native function interface, simpler. Added type() to baselib.

Large overhaul - every LValue (and LBinaryChunk) now has a valid 'vm' property, so we know in which LVM to call it or its metamethods

Give LValue an add() method, to eventually respect metamethods

Change some decimal constants to hex for consistency

Shorten loop test a little so I don't have to wait so long...

Move the demo_account.lua test from fail to pass - yay!

Switch to sys.puts for all output for now, leaving browser compatibility for the moment.

Formalise the beginnings of a baselib, add setmetatable.

Add FIXME for something that works, but shouldn't...

splice != slice. Dear Javascript, this is only one reason for why I don't like you.

Correct off-by-one in return value limits

New interface for native Javascript functions called from Lua

Support for numbers in LValueFromValue()

Add LValue.toString()

Support for tables in __index

Implement OP_TESTSET

Implement OP_ADD, OP_SUB, OP_LT

Add tests/ to the repo

Move try {} block so it covers more of the VM initialization

Add test __index handler to catch use of nil globals

Support for __index metamethod

Add LValue.setMetatable()

Pass vm as 'this' to native functions

More reliable detection of when we're at a native/Lua call boundary

LValueFromValue handles undefined and objects/arrays

Give LValue precall() and call() methods, give functions a vm property.

Show return values on exit

Support for return values from LVM.call()

Merge backout

Backed out changeset 741b953fcc5f (premature optimisations == bad)

Exit with failure code on error

Give LFunctions a vm property

Localize instructions and reg from frame

Split LVM.run() into LVM.call()/LVM.run()

Implement OP_TEST and OP_JMP

Implement OP_LOADBOOL

Initialise all stack slots to nil when calling a chunk

Allow LValues with a value of 'false' to be create (it was converted to 'null')

Implement OP_SELF

Fix for error handling to handle string exceptions

OP_FORPREP, OP_FORLOOP: Support for numerical for loops

Instantiate a new LValue in OP_LOADK, otherwise "constants" aren't so constant...

Fix off-by-one in calculating the value of sBx

Print sBx field in bytecode dump (for debugging)

Couple of fixes for last commit

Remove rawExceptions flag, always print exception's stack trace if it has one

Support for OP_NEWTABLE, OP_GETTABLE, OP_SETTABLE

New LValueFromValue() to convert from any Javascript value (almost) to a LValue

Implement OP_SETUPVALUE \o/

Add new debug option - rawExceptions - to prevent catching exceptions thrown by the VM, use for debugging the VM.

It's required to insert the new function into the stack before processing its upvalue instructions, in case it refers to itself.

(0) -120 tip

mercurial