Search found 36 matches

by rok
Fri Oct 30, 2015 7:42 pm
Forum: General
Topic: Understanding luajit
Replies: 6
Views: 4598

Re: Understanding luajit

I knew what a JIT compiler is. Was just wondering about the bytecode. Thank you :awesome:

So the only only simple speedup I can do apart from running my code with LuaJIT is to use its FFI interface when possible and replace some of the stuff with C types right?
by rok
Fri Oct 30, 2015 12:21 pm
Forum: General
Topic: Understanding luajit
Replies: 6
Views: 4598

Re: Understanding luajit

Why would you export a lua file? Is that even possible? The output file type is auto-detected from the extension of the output file name: c — C source file, exported bytecode data. h — C header file, static bytecode data. obj or o — Object file, exported bytecode data (OS- and architecture-specific)...
by rok
Fri Oct 30, 2015 8:38 am
Forum: General
Topic: Understanding luajit
Replies: 6
Views: 4598

Understanding luajit

I'm taking a look at luajit . I'd like to learn how to properly use it to speed up my code. I know how to use its FFI extension but I'd like to know how to work with its bytecode exporter. After I get the object file with luajit -b some_library.lua some_library.o for example, it says I should link i...
by rok
Sun Oct 18, 2015 7:26 am
Forum: General
Topic: Binary File to String of 0s and 1s
Replies: 9
Views: 4470

Re: Binary File to String of 0s and 1s

Yeah I have to run over every bit :? Now you've guys helped me a lot already :) This part is very fast now. local lookup = require "lookuptable8bits" -- ... local t = {} for i=1, #file_content, 1 do table.insert(t, lookup[string.byte(file_content, i)+1]) end local all_content = table.conca...
by rok
Sat Oct 17, 2015 10:25 pm
Forum: General
Topic: Binary File to String of 0s and 1s
Replies: 9
Views: 4470

Re: Binary File to String of 0s and 1s

@bakpakin I swapped all of the .. with table.concat and made a lookup table like you suggested. It's a bit faster and the code is cleaner. Thank you ^^

@kikito I'll take a look, thanks :)

@jjmafiae Ok
by rok
Sat Oct 17, 2015 8:06 pm
Forum: General
Topic: Binary File to String of 0s and 1s
Replies: 9
Views: 4470

Binary File to String of 0s and 1s

I'm reading a ~500kB binary file via io.open and io.read. This is very fast. But now I need to get every character that was read from the file converted to a string of zeros and ones. I wrote my own function for that, but it is very slow. function Converter:UnsignedCharToBits(number) local output = ...
by rok
Thu Oct 01, 2015 11:15 am
Forum: Support and Development
Topic: luarocks and the path
Replies: 2
Views: 2748

luarocks and the path

I have a problem with require.

It does not check on the rocks path /usr/local/lib/luarocks/rocks.

I can solve this for regular lua scripts by running luarocks path.

Can I do it somehow for love or even make it permanent?
by rok
Mon Jul 27, 2015 6:15 pm
Forum: Support and Development
Topic: [SOLVED]Reading a lua file which contains only a table
Replies: 3
Views: 1503

Re: Reading a lua file which contains only a table

Solved it but I don't understand why the former option wouldn't work. -- this works local t = { {true, false, false, false, false}, {false, true, false, false, false}, {false, false, true, false, false} } return t -- this does not return { {true, false, false, false, false}, {false, true, false, fal...
by rok
Mon Jul 27, 2015 3:46 pm
Forum: Support and Development
Topic: [SOLVED]Reading a lua file which contains only a table
Replies: 3
Views: 1503

Re: Reading a lua file which contains only a table

@ivan I'm implementing a simple import/export module for my data. I've already used serialization to make the export of boolean values into a lua file. There's no error running the code I mentioned before, the thing is that the Something.data variable contains the boolean true instead of the table i...
by rok
Mon Jul 27, 2015 3:32 pm
Forum: Support and Development
Topic: [SOLVED]Reading a lua file which contains only a table
Replies: 3
Views: 1503

[SOLVED]Reading a lua file which contains only a table

How that I can't simply require a lua file which returns a table with values? -- Lets say that my file is named file.lua IO.Import = function (filename) return require(filename) end -- I call it using Something.data = IO.Import("file") It says that I'm attempting to index a field which is ...