Making some more Lua 5.3 functions available and preparing for making UTF-8 lib available.

The latter of which will require a recompile of the natives, so not yet.
This commit is contained in:
Florian Nücke 2015-05-28 14:36:38 +02:00
parent cf83f5d82b
commit 806ed9ab85
3 changed files with 23 additions and 3 deletions

Binary file not shown.

View File

@ -786,7 +786,9 @@ sandbox = {
end, end,
yield = function(...) -- custom yield part for bubbling sysyields yield = function(...) -- custom yield part for bubbling sysyields
return coroutine.yield(nil, ...) return coroutine.yield(nil, ...)
end end,
-- Lua 5.3.
isyieldable = coroutine.isyieldable
}, },
string = { string = {
@ -854,10 +856,16 @@ sandbox = {
sinh = math.sinh, sinh = math.sinh,
sqrt = math.sqrt, sqrt = math.sqrt,
tan = math.tan, tan = math.tan,
tanh = math.tanh tanh = math.tanh,
-- Lua 5.3.
maxinteger = math.maxinteger,
mininteger = math.mininteger,
tointeger = math.tointeger,
type = math.type,
ult = math.ult
}, },
-- No longer available in Lua 5.3. -- Deprecated in Lua 5.3.
bit32 = bit32 and { bit32 = bit32 and {
arshift = bit32.arshift, arshift = bit32.arshift,
band = bit32.band, band = bit32.band,
@ -918,6 +926,16 @@ sandbox = {
traceback = debug.traceback traceback = debug.traceback
}, },
-- Lua 5.3.
utf8 = utf8 and {
char = utf8.char,
charpattern = utf8.charpattern,
codes = utf8.codes,
codepoint = utf8.codepoint,
len = utf8.len,
offset = utf8.offset
},
checkArg = checkArg checkArg = checkArg
} }
sandbox._G = sandbox sandbox._G = sandbox

View File

@ -57,6 +57,8 @@ object LuaStateFactory {
state.openLib(jnlua.LuaState.Library.MATH) state.openLib(jnlua.LuaState.Library.MATH)
state.openLib(jnlua.LuaState.Library.STRING) state.openLib(jnlua.LuaState.Library.STRING)
state.openLib(jnlua.LuaState.Library.TABLE) state.openLib(jnlua.LuaState.Library.TABLE)
// TODO Enable once I update the natives.
// state.openLib(jnlua.LuaState.Library.UTF8)
state.pop(7) state.pop(7)
} }
} }