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

Check for errors #14

Open
Enn3Developer opened this issue Jun 15, 2022 · 5 comments
Open

Check for errors #14

Enn3Developer opened this issue Jun 15, 2022 · 5 comments
Labels
enhancement New feature or request experimental The changes may break something or be a bad idea

Comments

@Enn3Developer
Copy link
Member

Enn3Developer commented Jun 15, 2022

At the current state, the compiler doesn't check if a function called in a file from another file is either local or global thus making errors go through the Lua version.
Example:
main.clue

local test = import("test")

local fn print_var(var) {
    print("Info " .. var)
}

print_var("Hello")
print_var(double(2))
print_var(multiply(2, 2))

test.clue

local fn multiply(a, b) {
    return a * b
}

global fn double(a) {
    return multiply(a, 2)
}

lua main.lua

Info Hello
Info 4
lua: main.lua:40: attempt to call a nil value (global 'multiply')
stack traceback:
        main.lua:40: in local 'cached'
        main.lua:11: in local 'import'
        main.lua:44: in main chunk
        [C]: in ?
@Maiori44
Copy link
Member

that is intended?
if a function is local it cannot be accessed from other files

@Enn3Developer
Copy link
Member Author

yes, but Clue didn't report it during compilation, that's my point

@Maiori44
Copy link
Member

Maiori44 commented Jun 15, 2022

Clue does not keep track of any variable created, it lets Lua handle that
This feature will very probably be added alongside types in Clue 3.0

Edit: 4.0 now...

@Maiori44 Maiori44 added enhancement New feature or request experimental The changes may break something or be a bad idea labels Jun 15, 2022
@Maiori44 Maiori44 added this to the 3.0 milestone Jun 15, 2022
@Maiori44 Maiori44 modified the milestones: 3.0, 4.0 Nov 18, 2022
@Markos-Th09
Copy link
Member

in 3.0 it is possible to implement this when using the mlua feature

@Maiori44
Copy link
Member

This is why this is for 4.0

@Maiori44 Maiori44 moved this to Todo in Update 4.0 Nov 30, 2023
@Maiori44 Maiori44 removed this from the 4.0 milestone Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request experimental The changes may break something or be a bad idea
Projects
Status: Todo
Development

No branches or pull requests

3 participants