Ian Farmer
6d0e9bb566
Add some helper methods:
...
(1) getKeys() in LTable is now public. It provides a convenient interface
to access the table's elements from Java instead of Lua.
(2) LString.toInputStream produces an instance of InputStream from which
the string's bytes can be read.
2007-09-12 05:22:30 +00:00
Ian Farmer
aeafca11b6
Change LString to use an array of bytes instead of wrapping Java's String.
...
This brings our implementation more in line with regular C Lua.
2007-09-10 06:27:54 +00:00
Ian Farmer
aa44eedf4b
Allow metatable operations on values of all types, and use the metatable
...
on strings as the string package, so that string functions can be called
with self (:) syntax. Autoload test case now inexplicably fails more,
but it was already broken.
2007-09-08 20:54:40 +00:00
Ian Farmer
0f81c4deaf
Fix typo and add TODO comment.
2007-09-03 06:00:37 +00:00
Ian Farmer
49bcc0d2f8
Fix a bug where "base" was not set correctly for metatable operations.
2007-09-03 05:53:55 +00:00
Ian Farmer
b8571b93f9
New implementation for Lua tables. Does not use Vector or Hashtable, instead
...
uses plain Java arrays directly to keep heap allocation to a minimum.
Includes some unit tests that seem to indicate the basic operations are
correct. However, the following things are not implemented:
* Shrinking the capacity when elements are removed
* Optimal storage of each element in array vs. hash when entries are
added out of order. A junit test case is there for this.
2007-09-03 00:38:38 +00:00
James Roseborough
5fb097d107
Fix varargs handling
2007-08-02 03:00:46 +00:00
James Roseborough
80677e9a16
Let Nil be converted to int, but other values cannot.
2007-08-01 06:16:28 +00:00
James Roseborough
01c5595fd6
Let luaAsInt() return sensible values for non-numeric data.
2007-08-01 06:11:43 +00:00
James Roseborough
32dcbaca3a
Make modulo arithmetic conform to lua rules for negative values.
2007-08-01 04:57:12 +00:00
Ian Farmer
737c5e2855
Various changes:
...
(1) New lua compatibility bindings, including select() and math functions
(2) fix some VM bugs
(3) fix some table bugs, and attempt to restore metatable functionality.
2007-08-01 04:15:27 +00:00
James Roseborough
7cd3195bcd
Add guard to prevent null values from being put on stack
2007-07-30 04:53:58 +00:00
Christopher Colby
b9fdb731fe
optimization for tables that include sequential integral indices starting with 0.
...
commented out: a more sophisticated (but space-consuming) optimization
that accounts for arbitrary starting index, stride, and direction (increasing/decreasing).
commented out some table metatable stuff that was wrong. metatables
need to be implemented properly.
2007-07-24 06:22:07 +00:00
James Roseborough
8bf4c82a12
Rework the main API"s that implement the calling convention. Provide utility methods to get arguments that were supplied, and provide return values. Add a VM interface to clarify the relationship between the VM, things that call the VM, and things that are called by the VM. Make the code more closely aligned with the C++ version.
2007-07-24 05:06:10 +00:00
Ian Farmer
ee5007e718
Add implicit LString to number coercions.
2007-07-22 06:20:14 +00:00
Ian Farmer
2a64db32b5
Add last Lua type: userdata. Changed LInstance to inherit from LUserData,
...
and changed instanceof/casts to LInstance to use LUserData instead. This
should enable various add-ons to be compatible without knowing much, or
anything, about each other.
2007-07-17 04:04:18 +00:00
Ian Farmer
635f127cd0
Add new built-in function type() that returns the name of the type of
...
the given value as a string. Includes test case.
2007-07-16 02:37:08 +00:00
James Roseborough
7aab64e6d3
Allow null values in arguments to pushCall, expose the underlying storage in LTable to simplify add-ons until the lTable is finished.
2007-07-02 14:39:17 +00:00
James Roseborough
c8e1934916
Refactor call stack and its use throughout. CallFrame now does all bytecode processing, and the callframe is reinitialized anytime something might have changed, like a function call.
2007-06-27 06:43:33 +00:00
James Roseborough
93fc4699a9
Type coercion for luajava package, make luajava an "addon"
2007-06-24 15:04:19 +00:00
James Roseborough
99077764ac
Fix basic class processing via metatables. Make print output more closely match that produces by C interpreter
2007-06-19 04:25:34 +00:00
James Roseborough
54927db2fc
Implement most of metatables
2007-06-17 02:58:40 +00:00
James Roseborough
5d3c86e552
Partial implementation of metatables.
2007-06-16 15:31:27 +00:00
James Roseborough
7449605d56
Improve table processing when table lookup fails.
2007-06-16 04:42:20 +00:00
James Roseborough
be20581731
Improve call stack handling to prepare for propert tail call handling.
2007-06-15 06:41:40 +00:00
James Roseborough
19bd995ba6
Enhance binary compare operators, especially equals, to more closely match what standard lua does.
2007-06-14 04:58:09 +00:00
James Roseborough
da6f63bb3d
Fix calling convention by managing top of stack and adjusting on way in and out of function calls.
2007-06-11 05:51:19 +00:00
James Roseborough
05cfdaa33b
Improve calling convention handling when the number of arguments doesn't match the expected number, and the number of return values doesn't match those needed.
2007-06-11 04:30:03 +00:00
James Roseborough
de763e0a1e
Support for iterator-style for loops, and "pairs" builting function
2007-06-10 22:53:09 +00:00
James Roseborough
e1e6625aa1
Add binary compares, some unary ops, fix binary arithmetic, add plain for loop.
2007-06-10 19:49:47 +00:00
James Roseborough
70dfc20f57
Initial draft of interpreter. Lua compiled "chunks" can be unmarshalled. Approximately half of bytecodes implemented in some form or another.
2007-06-08 05:11:37 +00:00