Jump to content

attempt to index a number value


Recommended Posts

hi, why is this happening?

this is my part of code

function onStop() 
   fileDelete("ch/ch.reg"); 
   fileDelete("ch/ch.sys"); 
   local file1,file2 = fileCreate("ch/ch.reg"),fileCreate("ch/ch.sys"); 
   local tab1,tab2 = toJSON(reg),toJSON(sys); 
   fileWrite(file1,tab1): 
   fileWrite(file2,tab2): 
   fileClose(file1); 
   fileClose(file2); 
end; 
addEventHandler("onResourceStop",resourceRoot,onStop); 

first file is properly written data to and closed but the other file is running into issues

and everything in that function is defined

so what does this error mean? how do i fix it?

Link to comment

Lua won't enforce ; (semicolon) at the end of each line like other languages, and in your file you have : (regular colon) after the two write lines, at that runs upon resource stop you won't notice that the script crashes and stops running directly after the first file is written. Remove all the ; and : at the end of the lines and try it, that should work.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...