Merge branch 'MihailRis:main' into main
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"id": "base",
|
||||
"title": "Base",
|
||||
"version": "0.25",
|
||||
"version": "0.26",
|
||||
"description": "basic content package"
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
multiline='true'
|
||||
size-func="gui.get_viewport()[1],40"
|
||||
gravity="bottom-left"
|
||||
markup="md"
|
||||
></textbox>
|
||||
</container>
|
||||
<container id="editorContainer" pos="0,60" color="#00000080"
|
||||
@@ -32,10 +33,9 @@
|
||||
autoresize='true'
|
||||
margin='0'
|
||||
padding='5'
|
||||
editable='false'
|
||||
multiline='true'
|
||||
line-numbers='true'
|
||||
text-color="#FFFFFFA0"
|
||||
syntax='lua'
|
||||
size-func="gui.get_viewport()[1]-350,40"
|
||||
gravity="top-left"
|
||||
text-wrap='false'
|
||||
@@ -55,6 +55,7 @@
|
||||
<textbox id='prompt'
|
||||
consumer='submit'
|
||||
margin='0'
|
||||
markup="md"
|
||||
gravity='bottom-left'
|
||||
size-func="gui.get_viewport()[1],40"
|
||||
onup="on_history_up()"
|
||||
|
||||
+160
-63
@@ -12,17 +12,57 @@ local MIN_INT32 = -2147483648
|
||||
local MAX_INT64 = 9223372036854775807
|
||||
local MIN_INT64 = -9223372036854775808
|
||||
|
||||
local function intToByte(num)
|
||||
local function maskHighBytes(num)
|
||||
return bit.band(num, 0xFF)
|
||||
end
|
||||
|
||||
local function reverse(tab)
|
||||
for i = 1, math.floor(#tab, 2), 1 do
|
||||
tab[i], tab[#tab-i+1] = tab[#tab-i+1], tab[i]
|
||||
end
|
||||
return tab
|
||||
local function reverse(tbl)
|
||||
for i=1, math.floor(#tbl / 2) do
|
||||
local tmp = tbl[i]
|
||||
tbl[i] = tbl[#tbl - i + 1]
|
||||
tbl[#tbl - i + 1] = tmp
|
||||
end
|
||||
return tbl
|
||||
end
|
||||
|
||||
local orders = { "LE", "BE" }
|
||||
|
||||
local fromLEConvertors =
|
||||
{
|
||||
LE = function(bytes) return bytes end,
|
||||
BE = function(bytes) return reverse(bytes) end
|
||||
}
|
||||
|
||||
local toLEConvertors =
|
||||
{
|
||||
LE = function(bytes) return bytes end,
|
||||
BE = function(bytes) return reverse(bytes) end
|
||||
}
|
||||
|
||||
bit_converter.default_order = "LE"
|
||||
|
||||
local function fromLE(bytes, orderTo)
|
||||
if orderTo then
|
||||
bit_converter.validate_order(orderTo)
|
||||
return fromLEConvertors[orderTo](bytes)
|
||||
else return bytes end
|
||||
end
|
||||
|
||||
local function toLE(bytes, orderFrom)
|
||||
if orderFrom then
|
||||
bit_converter.validate_order(orderFrom)
|
||||
return toLEConvertors[orderFrom](bytes)
|
||||
else return bytes end
|
||||
end
|
||||
|
||||
function bit_converter.validate_order(order)
|
||||
if not bit_converter.is_valid_order(order) then
|
||||
error("invalid order: "..order)
|
||||
end
|
||||
end
|
||||
|
||||
function bit_converter.is_valid_order(order) return table.has(orders, order) end
|
||||
|
||||
function bit_converter.string_to_bytes(str)
|
||||
local bytes = { }
|
||||
|
||||
@@ -83,19 +123,12 @@ local function floatOrDoubleToBytes(val, opt)
|
||||
bytes[#bytes + 1] = math.floor(sign * 128 + val) % (2 ^ 8)
|
||||
val = math.floor((sign * 128 + val) / (2 ^ 8))
|
||||
|
||||
if not endianness then
|
||||
reverse(bytes)
|
||||
end
|
||||
return bytes
|
||||
end
|
||||
|
||||
local function bytesToFloatOrDouble(bytes, opt)
|
||||
local n = (opt == 'd') and 8 or 4
|
||||
|
||||
if not endianness then
|
||||
reverse(bytes)
|
||||
end
|
||||
|
||||
local sign = 1
|
||||
local mantissa = bytes[n - 1] % ((opt == 'd') and 16 or 128)
|
||||
for i = n - 2, 1, -1 do
|
||||
@@ -117,80 +150,128 @@ end
|
||||
|
||||
--
|
||||
|
||||
function bit_converter.single_to_bytes(float)
|
||||
return floatOrDoubleToBytes(float, 'f')
|
||||
function bit_converter.float32_to_bytes(float, order)
|
||||
return fromLE(floatOrDoubleToBytes(float, 'f'), order)
|
||||
end
|
||||
|
||||
function bit_converter.double_to_bytes(double)
|
||||
return floatOrDoubleToBytes(double, 'd')
|
||||
function bit_converter.float64_to_bytes(float, order)
|
||||
return fromLE(floatOrDoubleToBytes(float, 'd'), order)
|
||||
end
|
||||
|
||||
function bit_converter.uint32_to_bytes(int)
|
||||
function bit_converter.single_to_bytes(float, order)
|
||||
on_deprecated_call("bit_converter.float_to_bytes", "bit_converter.float32_to_bytes")
|
||||
return bit_converter.float32_to_bytes(bytes, order)
|
||||
end
|
||||
|
||||
function bit_converter.double_to_bytes(double, order)
|
||||
on_deprecated_call("bit_converter.double_to_bytes", "bit_converter.float64_to_bytes")
|
||||
return bit_converter.float64_to_bytes(bytes, order)
|
||||
end
|
||||
|
||||
local function uint32ToBytes(int, order)
|
||||
return fromLE({
|
||||
maskHighBytes(bit.rshift(int, 24)),
|
||||
maskHighBytes(bit.rshift(int, 16)),
|
||||
maskHighBytes(bit.rshift(int, 8)),
|
||||
maskHighBytes(int)
|
||||
}, order)
|
||||
end
|
||||
|
||||
local function uint16ToBytes(int, order)
|
||||
return fromLE({
|
||||
maskHighBytes(bit.rshift(int, 8)),
|
||||
maskHighBytes(int)
|
||||
}, order)
|
||||
end
|
||||
|
||||
function bit_converter.uint32_to_bytes(int, order)
|
||||
if int > MAX_UINT32 or int < MIN_UINT32 then
|
||||
error("invalid uint32")
|
||||
end
|
||||
|
||||
return {
|
||||
intToByte(bit.rshift(int, 24)),
|
||||
intToByte(bit.rshift(int, 16)),
|
||||
intToByte(bit.rshift(int, 8)),
|
||||
intToByte(int)
|
||||
}
|
||||
return uint32ToBytes(int, order)
|
||||
end
|
||||
|
||||
function bit_converter.uint16_to_bytes(int)
|
||||
function bit_converter.uint16_to_bytes(int, order)
|
||||
if int > MAX_UINT16 or int < MIN_UINT16 then
|
||||
error("invalid uint16")
|
||||
end
|
||||
|
||||
return {
|
||||
intToByte(bit.rshift(int, 8)),
|
||||
intToByte(int)
|
||||
}
|
||||
return uint16ToBytes(int, order)
|
||||
end
|
||||
|
||||
function bit_converter.int64_to_bytes(int)
|
||||
function bit_converter.int64_to_bytes(int, order)
|
||||
if int > MAX_INT64 or int < MIN_INT64 then
|
||||
error("invalid int64")
|
||||
end
|
||||
|
||||
return {
|
||||
intToByte(bit.rshift(int, 56)),
|
||||
intToByte(bit.rshift(int, 48)),
|
||||
intToByte(bit.rshift(int, 40)),
|
||||
intToByte(bit.rshift(int, 32)),
|
||||
intToByte(bit.rshift(int, 24)),
|
||||
intToByte(bit.rshift(int, 16)),
|
||||
intToByte(bit.rshift(int, 8)),
|
||||
intToByte(int)
|
||||
}
|
||||
return fromLE({
|
||||
maskHighBytes(bit.rshift(int, 56)),
|
||||
maskHighBytes(bit.rshift(int, 48)),
|
||||
maskHighBytes(bit.rshift(int, 40)),
|
||||
maskHighBytes(bit.rshift(int, 32)),
|
||||
maskHighBytes(bit.rshift(int, 24)),
|
||||
maskHighBytes(bit.rshift(int, 16)),
|
||||
maskHighBytes(bit.rshift(int, 8)),
|
||||
maskHighBytes(int)
|
||||
}, order)
|
||||
end
|
||||
|
||||
function bit_converter.int32_to_bytes(int)
|
||||
function bit_converter.int32_to_bytes(int, order)
|
||||
on_deprecated_call("bit_converter.int32_to_bytes", "bit_converter.sint32_to_bytes")
|
||||
|
||||
if int > MAX_INT32 or int < MIN_INT32 then
|
||||
error("invalid int32")
|
||||
end
|
||||
|
||||
return bit_converter.uint32_to_bytes(int + MAX_INT32)
|
||||
return uint32ToBytes(int + MAX_INT32, order)
|
||||
end
|
||||
|
||||
function bit_converter.int16_to_bytes(int)
|
||||
function bit_converter.int16_to_bytes(int, order)
|
||||
on_deprecated_call("bit_converter.int32_to_bytes", "bit_converter.sint16_to_bytes")
|
||||
|
||||
if int > MAX_INT16 or int < MIN_INT16 then
|
||||
error("invalid int16")
|
||||
end
|
||||
|
||||
return bit_converter.uint16_to_bytes(int + MAX_INT16)
|
||||
return uint16ToBytes(int + MAX_INT16, order)
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_single(bytes)
|
||||
return bytesToFloatOrDouble(bytes, 'f')
|
||||
function bit_converter.sint32_to_bytes(int, order)
|
||||
if int > MAX_INT32 or int < MIN_INT32 then
|
||||
error("invalid sint32")
|
||||
end
|
||||
|
||||
return uint32ToBytes(int + MAX_UINT32 + 1, order)
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_double(bytes)
|
||||
return bytesToFloatOrDouble(bytes, 'd')
|
||||
function bit_converter.sint16_to_bytes(int, order)
|
||||
if int > MAX_INT16 or int < MIN_INT16 then
|
||||
error("invalid sint16")
|
||||
end
|
||||
|
||||
return uint16ToBytes(int + MAX_UINT16 + 1, order)
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_string(bytes)
|
||||
function bit_converter.bytes_to_float32(bytes, order)
|
||||
return bytesToFloatOrDouble(toLE(bytes, order), 'f')
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_float64(bytes, order)
|
||||
return bytesToFloatOrDouble(toLE(bytes, order), 'd')
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_single(bytes, order)
|
||||
on_deprecated_call("bit_converter.bytes_to_single", "bit_converter.bytes_to_float32")
|
||||
return bit_converter.bytes_to_float32(bytes, order)
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_double(bytes, order)
|
||||
on_deprecated_call("bit_converter.bytes_to_double", "bit_converter.bytes_to_float64")
|
||||
return bit_converter.bytes_to_float64(bytes, order)
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_string(bytes, order)
|
||||
local len = bit_converter.bytes_to_uint16({ bytes[1], bytes[2] })
|
||||
|
||||
local str = ""
|
||||
@@ -206,17 +287,13 @@ function bit_converter.byte_to_bool(byte)
|
||||
return byte ~= 0
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_float(bytes)
|
||||
if #bytes < 8 then
|
||||
error("eof")
|
||||
end
|
||||
error("unsupported operation")
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_uint32(bytes)
|
||||
function bit_converter.bytes_to_uint32(bytes, order)
|
||||
if #bytes < 4 then
|
||||
error("eof")
|
||||
end
|
||||
|
||||
bytes = toLE(bytes, order)
|
||||
|
||||
return
|
||||
bit.bor(
|
||||
bit.bor(
|
||||
@@ -226,20 +303,26 @@ function bit_converter.bytes_to_uint32(bytes)
|
||||
bit.lshift(bytes[3], 8)),bytes[4])
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_uint16(bytes)
|
||||
function bit_converter.bytes_to_uint16(bytes, order)
|
||||
if #bytes < 2 then
|
||||
error("eof")
|
||||
end
|
||||
|
||||
bytes = toLE(bytes, order)
|
||||
|
||||
return
|
||||
bit.bor(
|
||||
bit.lshift(bytes[1], 8),
|
||||
bytes[2], 0)
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_int64(bytes)
|
||||
function bit_converter.bytes_to_int64(bytes, order)
|
||||
if #bytes < 8 then
|
||||
error("eof")
|
||||
end
|
||||
|
||||
bytes = toLE(bytes, order)
|
||||
|
||||
return
|
||||
bit.bor(
|
||||
bit.bor(
|
||||
@@ -257,12 +340,26 @@ function bit_converter.bytes_to_int64(bytes)
|
||||
bit.lshift(bit.band(bytes[7], 0xFF), 8)),bit.band(bytes[8], 0xFF))
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_int32(bytes)
|
||||
return bit_converter.bytes_to_uint32(bytes) - MAX_INT32
|
||||
function bit_converter.bytes_to_int32(bytes, order)
|
||||
on_deprecated_call("bit_converter.bytes_to_int32", "bit_converter.bytes_to_sint32")
|
||||
return bit_converter.bytes_to_uint32(bytes, order) - MAX_INT32
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_int16(bytes)
|
||||
return bit_converter.bytes_to_uint16(bytes) - MAX_INT16
|
||||
function bit_converter.bytes_to_int16(bytes, order)
|
||||
on_deprecated_call("bit_converter.bytes_to_int16", "bit_converter.bytes_to_sint16")
|
||||
return bit_converter.bytes_to_uint16(bytes, order) - MAX_INT16
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_sint32(bytes, order)
|
||||
local num = bit_converter.bytes_to_uint32(bytes, order)
|
||||
|
||||
return MIN_INT32 * (bit.band(MAX_INT32 + 1, num) ~= 0 and 1 or 0) + bit.band(MAX_INT32, num)
|
||||
end
|
||||
|
||||
function bit_converter.bytes_to_sint16(bytes, order)
|
||||
local num = bit_converter.bytes_to_uint16(bytes, order)
|
||||
|
||||
return MIN_INT16 * (bit.band(MAX_INT16 + 1, num) ~= 0 and 1 or 0) + bit.band(MAX_INT16, num)
|
||||
end
|
||||
|
||||
return bit_converter
|
||||
|
||||
+88
-27
@@ -18,22 +18,31 @@ local TYPE_UINT32 = 2
|
||||
local TYPE_INT16 = 3
|
||||
local TYPE_INT32 = 4
|
||||
local TYPE_INT64 = 5
|
||||
local TYPE_DOUBLE = 6
|
||||
local TYPE_FLOAT64 = 6
|
||||
local TYPE_SINT16 = 7
|
||||
local TYPE_SINT32 = 8
|
||||
|
||||
-- Data buffer
|
||||
|
||||
local data_buffer =
|
||||
{
|
||||
__call =
|
||||
function(data_buffer, bytes)
|
||||
return data_buffer:new(bytes)
|
||||
function(data_buffer, ...)
|
||||
return data_buffer:new(...)
|
||||
end
|
||||
}
|
||||
|
||||
function data_buffer:new(bytes)
|
||||
function data_buffer:new(bytes, order, useBytearray)
|
||||
bytes = bytes or { }
|
||||
|
||||
if order then bit_converter.validate_order(order)
|
||||
else order = bit_converter.default_order end
|
||||
|
||||
local obj = {
|
||||
pos = 1,
|
||||
bytes = bytes or { }
|
||||
order = order,
|
||||
useBytearray = useBytearray or false,
|
||||
bytes = useBytearray and Bytearray(bytes) or bytes
|
||||
}
|
||||
|
||||
self.__index = self
|
||||
@@ -42,6 +51,13 @@ function data_buffer:new(bytes)
|
||||
return obj
|
||||
end
|
||||
|
||||
function data_buffer:set_order(order)
|
||||
bit_converter.validate_order(order)
|
||||
|
||||
self.order = order
|
||||
self.floatsOrder = order
|
||||
end
|
||||
|
||||
-- Push functions
|
||||
|
||||
function data_buffer:put_byte(byte)
|
||||
@@ -49,7 +65,8 @@ function data_buffer:put_byte(byte)
|
||||
error("invalid byte")
|
||||
end
|
||||
|
||||
self.bytes[self.pos] = byte
|
||||
if self.useBytearray then self.bytes:insert(self.pos, byte)
|
||||
else table.insert(self.bytes, self.pos, byte) end
|
||||
|
||||
self.pos = self.pos + 1
|
||||
end
|
||||
@@ -61,11 +78,21 @@ function data_buffer:put_bytes(bytes)
|
||||
end
|
||||
|
||||
function data_buffer:put_single(single)
|
||||
self:put_bytes(bit_converter.single_to_bytes(single))
|
||||
on_deprecated_call("data_buffer:put_single", "data_buffer:put_float32")
|
||||
self:put_bytes(bit_converter.single_to_bytes(single, self.order))
|
||||
end
|
||||
|
||||
function data_buffer:put_double(double)
|
||||
self:put_bytes(bit_converter.double_to_bytes(double))
|
||||
on_deprecated_call("data_buffer:put_single", "data_buffer:put_float64")
|
||||
self:put_bytes(bit_converter.double_to_bytes(double, self.order))
|
||||
end
|
||||
|
||||
function data_buffer:put_float32(single)
|
||||
self:put_bytes(bit_converter.float32_to_bytes(single, self.order))
|
||||
end
|
||||
|
||||
function data_buffer:put_float64(float)
|
||||
self:put_bytes(bit_converter.float64_to_bytes(float, self.order))
|
||||
end
|
||||
|
||||
function data_buffer:put_string(str)
|
||||
@@ -77,23 +104,33 @@ function data_buffer:put_bool(bool)
|
||||
end
|
||||
|
||||
function data_buffer:put_uint16(uint16)
|
||||
self:put_bytes(bit_converter.uint16_to_bytes(uint16))
|
||||
self:put_bytes(bit_converter.uint16_to_bytes(uint16, self.order))
|
||||
end
|
||||
|
||||
function data_buffer:put_uint32(uint32)
|
||||
self:put_bytes(bit_converter.uint32_to_bytes(uint32))
|
||||
self:put_bytes(bit_converter.uint32_to_bytes(uint32, self.order))
|
||||
end
|
||||
|
||||
function data_buffer:put_int16(int16)
|
||||
self:put_bytes(bit_converter.int16_to_bytes(int16))
|
||||
on_deprecated_call("data_buffer:put_int16", "data_buffer:put_sint16")
|
||||
self:put_bytes(bit_converter.int16_to_bytes(int16, self.order))
|
||||
end
|
||||
|
||||
function data_buffer:put_int32(int32)
|
||||
self:put_bytes(bit_converter.int32_to_bytes(int32))
|
||||
on_deprecated_call("data_buffer:put_int32", "data_buffer:put_sint32")
|
||||
self:put_bytes(bit_converter.int32_to_bytes(int32, self.order))
|
||||
end
|
||||
|
||||
function data_buffer:put_sint16(int16)
|
||||
self:put_bytes(bit_converter.sint16_to_bytes(int16, self.order))
|
||||
end
|
||||
|
||||
function data_buffer:put_sint32(int32)
|
||||
self:put_bytes(bit_converter.sint32_to_bytes(int32, self.order))
|
||||
end
|
||||
|
||||
function data_buffer:put_int64(int64)
|
||||
self:put_bytes(bit_converter.int64_to_bytes(int64))
|
||||
self:put_bytes(bit_converter.int64_to_bytes(int64, self.order))
|
||||
end
|
||||
|
||||
function data_buffer:put_number(num)
|
||||
@@ -101,8 +138,8 @@ function data_buffer:put_number(num)
|
||||
local type
|
||||
|
||||
if math.floor(num) ~= num then
|
||||
type = TYPE_DOUBLE
|
||||
bytes = bit_converter.double_to_bytes(num)
|
||||
type = TYPE_FLOAT64
|
||||
bytes = bit_converter.float64_to_bytes(num)
|
||||
elseif num == 0 then
|
||||
type = TYPE_ZERO
|
||||
bytes = { }
|
||||
@@ -119,11 +156,11 @@ function data_buffer:put_number(num)
|
||||
end
|
||||
elseif num < 0 then
|
||||
if num >= MIN_INT16 then
|
||||
type = TYPE_INT16
|
||||
bytes = bit_converter.int16_to_bytes(num)
|
||||
type = TYPE_SINT16
|
||||
bytes = bit_converter.sint16_to_bytes(num)
|
||||
elseif num >= MIN_INT32 then
|
||||
type = TYPE_INT32
|
||||
bytes = bit_converter.int32_to_bytes(num)
|
||||
type = TYPE_SINT32
|
||||
bytes = bit_converter.sint32_to_bytes(num)
|
||||
elseif num >= MIN_INT64 then
|
||||
type = TYPE_INT64
|
||||
bytes = bit_converter.int64_to_bytes(num)
|
||||
@@ -155,9 +192,13 @@ function data_buffer:get_number()
|
||||
return self:get_int16()
|
||||
elseif type == TYPE_INT32 then
|
||||
return self:get_int32()
|
||||
elseif type == TYPE_SINT16 then
|
||||
return self:get_sint16()
|
||||
elseif type == TYPE_SINT32 then
|
||||
return self:get_sint32()
|
||||
elseif type == TYPE_INT64 then
|
||||
return self:get_int64()
|
||||
elseif type == TYPE_DOUBLE then
|
||||
elseif type == TYPE_FLOAT64 then
|
||||
return self:get_double()
|
||||
else
|
||||
error("unknown lua number type: "..type)
|
||||
@@ -165,11 +206,21 @@ function data_buffer:get_number()
|
||||
end
|
||||
|
||||
function data_buffer:get_single()
|
||||
return bit_converter.bytes_to_single(self:get_bytes(4))
|
||||
on_deprecated_call("data_buffer:get_single", "data_buffer:get_float32")
|
||||
return bit_converter.bytes_to_single(self:get_bytes(4), self.order)
|
||||
end
|
||||
|
||||
function data_buffer:get_double()
|
||||
return bit_converter.bytes_to_double(self:get_bytes(8))
|
||||
on_deprecated_call("data_buffer:get_double", "data_buffer:get_float64")
|
||||
return bit_converter.bytes_to_double(self:get_bytes(8), self.order)
|
||||
end
|
||||
|
||||
function data_buffer:get_float32()
|
||||
return bit_converter.bytes_to_float32(self:get_bytes(4), self.order)
|
||||
end
|
||||
|
||||
function data_buffer:get_float64()
|
||||
return bit_converter.bytes_to_float64(self:get_bytes(8), self.order)
|
||||
end
|
||||
|
||||
function data_buffer:get_string()
|
||||
@@ -193,23 +244,33 @@ function data_buffer:get_bool()
|
||||
end
|
||||
|
||||
function data_buffer:get_uint16()
|
||||
return bit_converter.bytes_to_uint16(self:get_bytes(2))
|
||||
return bit_converter.bytes_to_uint16(self:get_bytes(2), self.order)
|
||||
end
|
||||
|
||||
function data_buffer:get_uint32()
|
||||
return bit_converter.bytes_to_uint32(self:get_bytes(4))
|
||||
return bit_converter.bytes_to_uint32(self:get_bytes(4), self.order)
|
||||
end
|
||||
|
||||
function data_buffer:get_int16()
|
||||
return bit_converter.bytes_to_int16(self:get_bytes(2))
|
||||
on_deprecated_call("data_buffer:get_int16", "data_buffer:get_sint16")
|
||||
return bit_converter.bytes_to_int16(self:get_bytes(2), self.order)
|
||||
end
|
||||
|
||||
function data_buffer:get_int32()
|
||||
return bit_converter.bytes_to_int32(self:get_bytes(4))
|
||||
on_deprecated_call("data_buffer:get_int32", "data_buffer:get_sint32")
|
||||
return bit_converter.bytes_to_int32(self:get_bytes(4), self.order)
|
||||
end
|
||||
|
||||
function data_buffer:get_sint16()
|
||||
return bit_converter.bytes_to_sint16(self:get_bytes(2), self.order)
|
||||
end
|
||||
|
||||
function data_buffer:get_sint32()
|
||||
return bit_converter.bytes_to_sint32(self:get_bytes(4), self.order)
|
||||
end
|
||||
|
||||
function data_buffer:get_int64()
|
||||
return bit_converter.bytes_to_int64(self:get_bytes(8))
|
||||
return bit_converter.bytes_to_int64(self:get_bytes(8), self.order)
|
||||
end
|
||||
|
||||
function data_buffer:size()
|
||||
|
||||
@@ -42,6 +42,7 @@ local Socket = {__index={
|
||||
close=function(self) return network.__close(self.id) end,
|
||||
is_alive=function(self) return network.__is_alive(self.id) end,
|
||||
is_connected=function(self) return network.__is_connected(self.id) end,
|
||||
get_address=function(self) return network.__get_address(self.id) end,
|
||||
}}
|
||||
|
||||
network.tcp_connect = function(address, port, callback)
|
||||
@@ -55,6 +56,7 @@ end
|
||||
local ServerSocket = {__index={
|
||||
close=function(self) return network.__closeserver(self.id) end,
|
||||
is_open=function(self) return network.__is_serveropen(self.id) end,
|
||||
get_port=function(self) return network.__get_serverport(self.id) end,
|
||||
}}
|
||||
|
||||
network.tcp_open = function(port, handler)
|
||||
|
||||
@@ -63,6 +63,20 @@ function table.copy(t)
|
||||
return copied
|
||||
end
|
||||
|
||||
function table.deep_copy(t)
|
||||
local copied = {}
|
||||
|
||||
for k, v in pairs(t) do
|
||||
if type(v) == "table" then
|
||||
copied[k] = table.deep_copy(v)
|
||||
else
|
||||
copied[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
return copied
|
||||
end
|
||||
|
||||
function table.count_pairs(t)
|
||||
local count = 0
|
||||
|
||||
|
||||
+57
-37
@@ -1,4 +1,4 @@
|
||||
# Общее
|
||||
# Umumiy
|
||||
Yes=Ha
|
||||
No=Yo'q
|
||||
Ok=Ок
|
||||
@@ -10,18 +10,26 @@ Version=Versiya
|
||||
Creator=Muallif
|
||||
Dependencies=Bog'liqliklar
|
||||
Description=Tavsif
|
||||
Converting world...=Dunyoni konvertatsiyalash amalga oshirilyapti...
|
||||
Converting world...=Dunyo konvertatsiya qilinmoqda...
|
||||
Unlimited=Cheksiz
|
||||
Chat=Suhbat
|
||||
Console=Konsol
|
||||
Log=log
|
||||
Problems=Muammolar
|
||||
Monitor=Monitoring
|
||||
Debug=Xatolarni tuzatish (Debug)
|
||||
File=Fayl
|
||||
|
||||
devtools.traceback=Chaqiruvlar steki (so‘nggisidan boshlab)
|
||||
error.pack-not-found=Paketni topib bo'lmadi
|
||||
error.dependency-not-found=Amaldagi qaramliklar topilmadi
|
||||
pack.remove-confirm=Paketlar bilan taqdim etilgan barcha mazmunni dunyodan olib tashlash (qaytarib bo'lmaydi)?
|
||||
pack.remove-confirm=Paketlar bilan taqdim etilgan barcha contentni dunyodan olib tashlash (qaytarib bo'lmaydi)?
|
||||
|
||||
# Подсказки
|
||||
# Maslahatlar
|
||||
graphics.gamma.tooltip=Yorug'lik yorqinligi egri chizig'i
|
||||
graphics.backlight.tooltip=To'liq zulmatni oldini oladigan orqa yorug'ligi
|
||||
|
||||
# Меню
|
||||
# Menyu
|
||||
menu.Apply=Qo'llash
|
||||
menu.Audio=Tovush
|
||||
menu.Back to Main Menu=Menyuga qaytish
|
||||
@@ -31,61 +39,73 @@ menu.Continue=Davom ettirish
|
||||
menu.Controls=Boshqaruv
|
||||
menu.Display=Displey
|
||||
menu.Graphics=Grafika
|
||||
menu.missing-content=Kontent etishmayapti!
|
||||
menu.missing-content=Kontent mavjud emas!
|
||||
menu.New World=Yangi Dunyo
|
||||
menu.Worlds=Dunyo
|
||||
menu.Open worlds folder=Dunyo papkasini ochish
|
||||
menu.Open worlds folder=Dunyolar papkasini ochish
|
||||
menu.Worlds=Dunyolar
|
||||
menu.Page not found=Sahifa topilmadi
|
||||
menu.Quit=Chiqish
|
||||
menu.Save and Quit to Menu=Saqlash va menyuga chiqish
|
||||
menu.Save and Quit to Menu=Saqlash va Menyuga chiqish
|
||||
menu.Settings=Sozlamalar
|
||||
menu.Contents Menu=Kontent to'plamlari menyusi
|
||||
menu.Reset settings=Sozlamalarni tiklash
|
||||
menu.Contents Menu=Kontent paklar menyusi
|
||||
menu.Open data folder=Ma'lumotlar papkasini ochish
|
||||
menu.Open content folder=[content] papkasini ochish
|
||||
|
||||
world.Seed=Don
|
||||
world.Name=Nom
|
||||
world.World generator=Dunyo yaratuvchi
|
||||
world.generators.default=Oddiy
|
||||
world.generators.flat=Yassi
|
||||
world.Create World=Dunyoni Yaratish
|
||||
world.convert-request=Indekslarda o‘zgarishlar mavjud! Dunyoni konvertatsiya qilish kerakmi?
|
||||
world.delete-confirm=Dunyoni qaytarib bo'lmaydigan tarzda olib tashlaysizmi?
|
||||
world.World generator=Dunyo generatori
|
||||
world.generators.default=Standart bo'yicha
|
||||
world.generators.flat=Tekis
|
||||
world.Create World=Dunyo yaratish
|
||||
world.convert-request=Indekslar bo'yicha o'zgarishlar bor! Dunyoni konvertatsiya qilasizmi?
|
||||
world.upgrade-request=Dunyo formati eskirgan! Dunyoni konvertatsiya qilasizmi?
|
||||
world.convert-with-loss=Dunyoni yo'qotishlar bilan konvertatsiya qilasizmi?
|
||||
world.convert-block-layouts=Blok maydonlarida o'zgarishlar bor! Dunyoni konvertatsiya qilasizmi?
|
||||
world.delete-confirm=Dunyoni doimiy o'chirasizmi?
|
||||
|
||||
# Настройки
|
||||
# Sozlamalar
|
||||
settings.Ambient=Fon
|
||||
settings.Backlight=Yoritish
|
||||
settings.Camera Shaking=Kamera Silkinishi
|
||||
settings.Camera Inertia=Kamera Inertsiyasi
|
||||
settings.Fog Curve=Tuman Egri Chizig'i
|
||||
settings.FOV=Ko'rish Maydoni
|
||||
settings.Camera Shaking=Kamera titrashi
|
||||
settings.Camera Inertia=Kamera inertsiyasi
|
||||
settings.Camera FOV Effects=Ko'rish maydoni effektlari
|
||||
settings.Fog Curve=Tuman egri chizig'i
|
||||
settings.FOV=Ko'rish maydoni
|
||||
settings.Fullscreen=To'liq ekran
|
||||
settings.Framerate=Kadr tezligi
|
||||
settings.Framerate=Kadrlar chastotasi
|
||||
settings.Gamma=Gamma
|
||||
settings.Language=Til
|
||||
settings.Load Distance=Yuklash Masofasi
|
||||
settings.Load Speed=Yuklash Tezligi
|
||||
settings.Master Volume=Umumiy Ovoz Balandligi
|
||||
settings.Mouse Sensitivity=Sichqoncha Sezgirligi
|
||||
settings.Load Distance=Yuklash masofasi
|
||||
settings.Load Speed=Yuklash tezligi
|
||||
settings.Master Volume=Umumiy ovoz balansi
|
||||
settings.Mouse Sensitivity=Sichqoncha sezgirligi
|
||||
settings.Music=Musiqa
|
||||
settings.Regular Sounds=Oddiy Tovushlar
|
||||
settings.UI Sounds=Interfeys Tovushlari
|
||||
settings.V-Sync=Vertikal Sinxronizatsiya
|
||||
settings.Regular Sounds=Oddiy tovushlar
|
||||
settings.UI Sounds=Interfeys tovushlari
|
||||
settings.V-Sync=Vertikal sinxronizatsiya
|
||||
settings.Key=Tugma
|
||||
settings.Controls Search Mode=Tayinlangan boshqaruv tugmasi bo'yicha qidirish
|
||||
settings.Limit Background FPS=Fon kadrlar chastotasini cheklash
|
||||
|
||||
# Управление
|
||||
# Boshqaruv
|
||||
chunks.reload=Chanklarni qayta yuklash
|
||||
devtools.console=Konsol
|
||||
movement.forward=Oldinga
|
||||
movement.back=Orqaga
|
||||
movement.left=Chapga
|
||||
movement.right=O'ng tomonda
|
||||
movement.right=O'ngga
|
||||
movement.jump=Sakrash
|
||||
movement.sprint=Tezlanish
|
||||
movement.sprint=Tez yugurish
|
||||
movement.crouch=Egilish
|
||||
movement.cheat=Chit
|
||||
hud.inventory=inventar
|
||||
movement.cheat=Hiyla (Chit)
|
||||
hud.inventory=Inventar
|
||||
player.pick=Blokni olish
|
||||
player.attack=Hujum Qilish / Sindirish
|
||||
player.build=Blokni Joylashtiring
|
||||
player.attack=Hujum qilish
|
||||
player.destroy=Sindirish
|
||||
player.build=Blokni qo'yish
|
||||
player.fast_interaction=Tezkor o'zaro ta'sir
|
||||
player.flight=Parvoz
|
||||
player.drop=Narsani tashlash
|
||||
camera.zoom=Yaqinlashish
|
||||
camera.mode=Kamera Rejimini O'zgartiring
|
||||
camera.mode=Kamera Rejimini O'zgartiring
|
||||
Reference in New Issue
Block a user