Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weird Index out of range error when programming in Lua/Löve2D #813

Closed
ghost opened this issue Sep 18, 2017 · 13 comments
Closed

Weird Index out of range error when programming in Lua/Löve2D #813

ghost opened this issue Sep 18, 2017 · 13 comments
Labels

Comments

@ghost
Copy link

ghost commented Sep 18, 2017

Description of the problem or steps to reproduce

Micro has been showing some "index out of range". Error only appeared when coding my Lua/Löve2D game for some reason, other codes I've done in XML, C and Python didn't presented this error.

Specifications

Linux xubuntu 17.04 and Debian 8.0
Last version of Micro (download made in 12 set 2017)

Complete error message:

runtime error: index out of range
stack traceback:
autoclose:226: in function autoclose:198
(tailcall): ?
autoclose:1128: in main chunk
[G]: ?

Other error instance:

Press enter to continue
runtime error: index out of range
stack traceback:
autoclose:226: in function autoclose:198
(tailcall): ?
autoclose:1067: in main chunk
[G]: ?

@zyedidia
Copy link
Owner

This seems like a duplicate of #457 and #565 (which are duplicates of each other). This gives more info though because you are using a newer version of micro which provides file and line number tracebacks for lua plugins. I unfortunately have never been able to reproduce this bug.

@ghost
Copy link
Author

ghost commented Sep 22, 2017

I was reviewing and adding touchscreen function to my pong game (on my github) and it started to appear more and more, at the point I needed to just give up and use atom. Just an update on the problem, I'm NOT trying to put pressure on you @zyedidia.

@zyedidia
Copy link
Owner

Hmm, could you provide concrete steps for how to reproduce the issue? Perhaps you could provide the file you were editing or a subset of it in which the issue still occurs?

@ghost
Copy link
Author

ghost commented Sep 22, 2017

The one that started giving me errors around every 10 lines were this one: https://github.com/gustavohmsilva/PONG/blob/master/pong-touch.love/main.lua

@zyedidia
Copy link
Owner

Do you have to type anything special? When I edit that file everything seems to perform as expected.

@ghost
Copy link
Author

ghost commented Sep 22, 2017

Well... My workflow is usually opening terminator with two windows, write code, ctrl+s to save the changes, ctrl+alt+down arrow to change terminal, run the modified code using love test.love, ctrl+alt+up arrow to change back, restart. I usually do that a damm lot to test changes made in the configuration of axis, dimensions of objects, positions and etc...

Another file that had been giving me the same errors on my two machines after 5, 10 minutes tops on the process above (a lenovo thinkpad x220 with debian/fluxbox+terminator and a Intell Skull Canyon with butuntu minimal/fluxbox+terminator) is this one:

https://gist.github.com/gustavohmsilva/ef1cdbd41e51f764912c5484f1b54d1e

PS: PLEASE don't make fun of my code. Most of the time I just do spaghetti code :D

@ghost ghost closed this as completed Sep 22, 2017
@zyedidia
Copy link
Owner

Alright I'll try to look into this. Any reason you closed the issue? Did you somehow see that it was fixed?

Also don't worry about your code, I'm not even trying to understand what it does, just looking at individual characters to see what could be causing the issue :).

@ghost
Copy link
Author

ghost commented Sep 22, 2017

I don't remember closing it to be honest. Must have mistyped something.

@ghost ghost reopened this Sep 22, 2017
@zyedidia zyedidia added the bug label Sep 24, 2017
@matbesancon
Copy link
Contributor

Hi, I just experienced the same issue while working on a markdown file. The error

runtime error: index out of range
stack traceback:
	autoclose:1047: in function 'charAt'
	autoclose:1106: in main chunk
	[G]: ?

Version

$ micro --version
Version: 1.3.4-dev.25
Commit hash: 3116b08
Compiled on October 04, 2017

On Ubuntu 16.04 LTS

@CamilleScholtz
Copy link
Contributor

CamilleScholtz commented Jan 9, 2018

I encountered this again:

runtime error: index out of range
stack traceback:
    autoclose:190: in function 'len'
    autoclose:1047: in function 'charAt'
    autoclose:1128: in main chunk
    [G]: ?

Press enter to continue
runtime error: index out of range
stack traceback:
    autoclose:1047: in function 'charAt'
    autoclose:1106: in main chunk
    [G]: ?

Press enter to continue

It really seems to happen randomly after editing for a few hours. But once it starts happening it happens every keypress.

@sum01
Copy link
Contributor

sum01 commented Jan 9, 2018

Yep, I've experienced the same kind of behaviour here #565 (comment)

@Wahib
Copy link

Wahib commented Nov 28, 2018

Just experienced this bug today on Ubuntu 18.04.

I am attaching the stack trace below.

runtime error: index out of range
stack traceback:
	autoclose:226: in function <autoclose:198>
	(tailcall): ?
	autoclose:1067: in main chunk
	[G]: ?

Press enter to continue
runtime error: index out of range
stack traceback:
	autoclose:226: in function <autoclose:198>
	(tailcall): ?
	autoclose:1128: in main chunk
	[G]: ?

Press enter to continue

Version

Version: 1.4.0
Commit hash: af520cf
Compiled on January 26, 2018

zyedidia added a commit that referenced this issue Dec 25, 2019
The code from the refactor that I have been working on is
now more or less ready to be merged. These changes make some
breaking changes, notably with regards to the plugin
interface. Once a lot more documentation has been written, I
will release this code as micro 2.0. There are a lot of new
features, and in the coming days I will try to go through
the open issues to see exactly which ones are addressed by
the new features, and write lots more documentation
regarding what has been implemented.

Some highlights include:

* Simple autocompletion.
    * Autocompletion (tab by default) will do a simple
      "buffer completion" which will autocomplete according
      to words used elsewhere in the buffer. In the future
      plugin support could be added along with support for
      interfacing with language-specific autocompletion
      tools.
* Automatic backups.
    * Backup files are stored in `~/.config/micro/backups`
      for every open buffer and are saved roughly every 8
      seconds if the buffer is being modified. Backups
      are removed when the buffer is closed, but if micro
      or the system crashes, any unsaved changes can be
      recovered by re-opening the file (micro will auto-
      recover) or by manually viewing the backup in the
      `~/.config/micro/backups` directory.
* Configurable statusline.
* Configurable linter plugin.
* Resizeable splits.
* Complete re-organization of the code to support better go
  modules and maintain a better directory structure.
* Better plugin interface with better access to the Go
  standard library and internal Micro functions (lots of
  documentation still needs to be written).
    * Documentation still needs to be written, but in the
      meantime please see the default plugins as examples
      as they have been converted from their old versions
      to be compatible with the new interface.
* Buffer synchronization when the same file is opened
  multiple times.
* Keybindings and mouse support in the command bar.
* Support for non-utf8 encodings.
* General QoL improvements and bug fixes.
    * Notably I believe the autoclose plugin crash issue is
      fixed.
* No more plugin manager.
    * Plugin installation will now be performed manually
      by git cloning into the `~/.config/micro/plug`
      directory. This may not be a highlight for some but
      I believe it is much simpler, and there is no need
      to have a heavyweight dependency manager. Perhaps
      in the future, a good command-line tool can be made
      to manage plugins if people would find it useful.
* Other features that I have forgotten.

Next I plan to write up more documentation for all the new
features, and make a "release candidate" for micro 2.0. I
will also be working to fix any bugs that come up (hopefully
not too many, but this is a big change and bound to have
some issues). After release I hope to focus more on
optimization (for example loading syntax files is currently
somewhat inefficient, and the bottleneck for startup time #1427).

Sorry for not being so active recently, but I hope merging
this big change can help me get back to more regular
development. Thanks to everyone for using micro and for
giving feedback and engaging with development online (even
if I don't always respond).

Merry Christmas!

Issues that are fixed/affected by this change:

Ref #1419 (configurable statusline)
Ref #1413 (cursor behaves better)
Ref #1401 (softwrap problems)
Ref #1383 (better save with sudo)
Ref #1424 (better save with sudo)
Ref #1382 (go modules)
Ref #1381 (install plugins from command line)
Ref #1357 (sorting -- textfilter)
Ref #1351 (custom linting)
Ref #1350 (sudo problem might be fixed)
Ref #1298 (readonly option)
Ref #1250 (autoclose bug)
Ref #1239 (go modules)
Ref #813  (autoclose bug)
Ref #812  (cursor sync across same buffers)
Ref #770  (resizeable panes)
Ref #635  (keybindings in infobar)
Ref #596  (disable builtin plugins)
Ref #550  (backups)
Ref #174  (autocompletion)
@zyedidia
Copy link
Owner

This was an issue with the autoclose plugin and should now be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants