Streaming I/O and support of named pipes (#570)
* added streaming i/o for scripting, and a byteutil.get_size function * added i/o stream class, also added named pipes support on lua side via ffi * added constant file.named_pipes_prefix * added buffered and yield modes for io_stream * added new time function for work with UTC - utc_time, utc_offset, local_time * docs updated * constant pid moved to os.pid * now gmtime_s and localtime_s used only in windows
This commit is contained in:
+22
-1
@@ -317,10 +317,30 @@ entities.get_all = function(uids)
|
||||
return stdcomp.get_all(uids)
|
||||
end
|
||||
end
|
||||
|
||||
local bytearray = require "core:internal/bytearray"
|
||||
|
||||
Bytearray = bytearray.FFIBytearray
|
||||
Bytearray_as_string = bytearray.FFIBytearray_as_string
|
||||
Bytearray_construct = function(...) return Bytearray(...) end
|
||||
|
||||
file.open = require "core:internal/stream_providers/file"
|
||||
file.open_named_pipe = require "core:internal/stream_providers/named_pipe"
|
||||
|
||||
if ffi.os == "Windows" then
|
||||
ffi.cdef[[
|
||||
unsigned long GetCurrentProcessId();
|
||||
]]
|
||||
|
||||
os.pid = ffi.C.GetCurrentProcessId()
|
||||
else
|
||||
ffi.cdef[[
|
||||
int getpid(void);
|
||||
]]
|
||||
|
||||
os.pid = ffi.C.getpid()
|
||||
end
|
||||
|
||||
ffi = nil
|
||||
|
||||
math.randomseed(time.uptime() * 1536227939)
|
||||
@@ -473,6 +493,7 @@ function __vc_on_world_quit()
|
||||
_rules.clear()
|
||||
gui_util:__reset_local()
|
||||
stdcomp.__reset()
|
||||
file.__close_all_descriptors()
|
||||
end
|
||||
|
||||
local __vc_coroutines = {}
|
||||
@@ -629,4 +650,4 @@ function dofile(path)
|
||||
end
|
||||
end
|
||||
return _dofile(path)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user