-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Change unpack to be indentical to table.unpack. Lua 5.1's unpack doesn't __len/__index (and so only works on tables, rather than userdata), but I don't think will break any existing code. - Remove several of our platform abstractions, and always just use the underlying OS API calls. This code only exists for passing the Lua tests (it's not used in CC at all), so the additional flexibility is not really useful. - Similarly, split BaseLib into a safe subset (as used by CC) and the full version as needed for tests. - Move the compiler interface to only generate functions from prototypes, rather than starting from scratch. We could remove it (luaj.luajc is long dead), I do have plans to have another go at using it. - Some small bits of cleanup while I was in the area.
- Loading branch information
Showing
81 changed files
with
1,655 additions
and
3,064 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package org.squiddev.cobalt; | ||
|
||
/** | ||
* The global registry, a store of Lua values | ||
*/ | ||
public final class GlobalRegistry { | ||
private final LuaTable table = new LuaTable(); | ||
|
||
GlobalRegistry() { | ||
} | ||
|
||
/** | ||
* Get the underlying registry table. | ||
* | ||
* @return The global debug registry. | ||
*/ | ||
public LuaTable get() { | ||
return table; | ||
} | ||
|
||
/** | ||
* Get a subtable in the global {@linkplain #get()} registry table}. If the key exists but is not a table, then | ||
* it will be overridden. | ||
* | ||
* @param name The name of the registry table. | ||
* @return The subentry. | ||
*/ | ||
public LuaTable getSubTable(LuaString name) { | ||
LuaValue value = table.rawget(name); | ||
if (value.isTable()) return (LuaTable) value; | ||
|
||
LuaTable newValue = new LuaTable(); | ||
table.rawset(name, newValue); | ||
return newValue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.