arcticfox1919/LuaDardo

Unable to create files using io.open()

Closed this issue · 2 comments

I'm trying to write a file on C:\Users\Public but when I call the code from file nothing happens

Here is my lua code

function testDartLua()
    file = io.open('C:\\Users\\Public\\file.txt', 'w')
    file:write('hello!')
    file:close(file)
end

And this is my dart code:

import 'package:lua_dardo/lua.dart';

void main(List<String> args) {
  LuaState state = LuaState.newState();
  state.openLibs();
  state.doFile('bin/main.lua');
  state.getGlobal("testDartLua");
  if (state.isFunction(-1)) {
    state.pCall(0, 0, 0);
  }
}

When I run this code the process ends correctly, but the file is not created in the specified directory.

I have also tried using doString(), yet I still got the same result

import 'package:lua_dardo/lua.dart';

void main(List<String> args) {
  LuaState state = LuaState.newState();
  state.openLibs();
  state.doString('''
  file = io.open('C:\\\\Users\\\\Public\\\\file.txt', 'w')
  file:write('hello!')
  file:close(file)
  ''');
}

I would really appreciate any help you can provide about why is this happening

Sorry, lua's standard library is not fully implemented!

I see. I'm looking forward to it being implemented, if it is possible in the future