Skip to content

Conversation

@Akeit0
Copy link
Collaborator

@Akeit0 Akeit0 commented May 10, 2025

The following code now works safely.

state.Environment["dostring"] = new LuaFunction("dostring",
    async (context, ct) =>
    {
        var source = context.GetArgument<string>(0);
        return context.Return(await context.Access.DoStringAsync(source, source, ct));
    });
 
var result = await state.DoStringAsync("""return dostring("return 1")""");

@nuskey8
What do you think about the naming of LuaThreadAccess and LuaState.TopLevelAccess?
TopLevelAccess is the one that only has access when the callstack is empty.

@Akeit0 Akeit0 requested a review from nuskey8 May 10, 2025 12:48
@Akeit0 Akeit0 self-assigned this May 10, 2025
@Akeit0
Copy link
Collaborator Author

Akeit0 commented May 11, 2025

Alternatives to toplevel are entry, root, and idle.

@nuskey8
Copy link
Owner

nuskey8 commented May 12, 2025

Looks good! I'd like to make some final adjustments to the API, but this should be enough for now.

@Akeit0 Akeit0 merged commit 147b498 into v0.5-dev May 12, 2025
@Akeit0 Akeit0 deleted the access-validation branch May 15, 2025 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants