• gm_curly
    38 replies, posted
  • [lua] debug.sethook() while true do if binread:GetReadPosition() > size then break end table.insert(out,binread:ReadString()) end local str = table.concat(out,"\0")[/lua] Froze my game for 20 seconds and then gave me a "out of memory" error in console :ohdear:
  • Avatar of LuaStoned
  • [QUOTE=Tobba;23561918][lua] debug.sethook() while true do if binread:GetReadPosition() > size then break end table.insert(out,binread:ReadString()) end local str = table.concat(out,"\0")[/lua] Froze my game for 20 seconds and then gave me a "out of memory" error in console :ohdear:[/QUOTE] [code] String concatenation, 25.000 times It took 3.11 seconds to finish! Table concatenation, 25.000 times It took 0.02 seconds to finish![/code]
  • Must been that loop then [editline]02:09PM[/editline] [lua] local size = binread:GetSize() local out = {} debug.sethook() while true do if binread:GetReadPosition() >= size then break end table.insert(out,binread:ReadString()) end local str = table.concat(out,"\0") if binread:GetReadPosition() == size then str = str..string.char(binread:ReadByte()) end[/lua] Very fast, but the code isnt very clean [editline]02:11PM[/editline] When i try to download a zip, 30 bytes is missing (probably file.Write glitchup) [editline]02:11PM[/editline] Ah yesm file.Write glitch [editline]02:15PM[/editline] 0.00128173828125 seconds to decode 45kb of data
  • Avatar of Grocel
  • If file.write doesn't work then try this: [url]http://www.facepunch.com/showthread.php?t=970999[/url] ;)
  • i got my own function for it, it was just windows being an asshole becuse i didnt open the file in binary mode
  • Error report: Lua: error loading module 'curly' from file 'c:\program files\steam\steamapps\*******\garrysmod\garrysmod\lua\includes\modules\gm_curly.dll': Det angivne modul blev ikke fundet. Windows 7 32 bit Need more info?
  • [QUOTE=Tobba;23592517]get the VC++ 2010 runtime package[/QUOTE] Right, that worked. Thanks