PlutoLang / Pluto

A superset of Lua 5.4 with a focus on general-purpose programming.
https://pluto-lang.org/docs/Introduction
MIT License
338 stars 20 forks source link

Add a type check to Pluto_operator_extends #849

Closed well-in-that-case closed 2 months ago

well-in-that-case commented 2 months ago

The current error sucks.

[Pluto-injected code]: attempt to index a nil value (local 'p')
stack traceback:
        [Pluto-injected code]: in local 'Pluto_operator_extends'
        stdin:1: in main chunk
        [C]: in ?

This is better.

stdin:1: expected a class or class-like table to extend, got nil
stack traceback:
        [C]: in function 'error'
        [Pluto-injected code]: in local 'Pluto_operator_extends'
        stdin:1: in main chunk
        [C]: in ?
Sainan commented 2 months ago

This would be a great place to use walrus operator 😉