nrother / dynamiclua

Wrapper for NLua, making access to lua more idomatic from .NET. Heavily using the "dynamic" keyword.
63 stars 10 forks source link

Can't use method lines() #12

Closed oslvbo closed 10 years ago

oslvbo commented 10 years ago

When I code like this:

function loadfile(filename) file = io.open(filename, 'r') for line in file:lines() do print(line) end end

open() is ok, but it will throw function error() when load on call "for line in file:lines()". Is there any method can fix this problem?

nrother commented 10 years ago

I assume this is a problem with the KopiLua/Mono version? In the normal version this work fine... Therefore I assume that this is problem with KopiLua itself. They have a REPL-style application there, maybe you can test the code with that app? You probably should open a bug report there.

The name loadfile sound like you try to load a lua file to execute the code in it. Maybe you should have a look a DoFile() instead? But I could be wrong :smile:

oslvbo commented 10 years ago

That's right, it's about KopiLua, not about DynamicLua.

"file" here I written is used to read some data, but I have written the code with C#.

So many thanks for your help, nrother!

nrother commented 10 years ago

I'm glad you found a workaround! Maybe you should file a bug for KopiLua? It looks like something that is easy to fix (probably they just got the line numbers messed up by one)