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

Add "import" Function and "UNSAFE_NO_SANDBOX" Flag for Accessing Built-in Lua Objects & Functions #359

Merged
merged 5 commits into from
May 2, 2023

Conversation

AntumDeluge
Copy link
Contributor

@AntumDeluge AntumDeluge commented Jul 23, 2021

Hoping this is a more acceptable solution than #308.

This adds an import function which is enabled with the UNSAFE_NO_SANDBOX command line flag & is used to access built-in Lua objects & functions within the config.ld file.

Example config.ld:

local print = import("print")
local string = import("string")

for _, s in ipairs({string.split("Hello world!")}) do
	print(s)
end

project = "foo"
title = "Bar"
file = {"init.lua"}

Example execution:

ldoc --UNSAFE_NO_SANDBOX .

@nawordar
Copy link

Is it necessary to make the flag SCREAM_CASE? I have never seen it used in command arguments. --disable_sandbox fits the current naming scheme and looks better.

@AntumDeluge
Copy link
Contributor Author

Is it necessary to make the flag SCREAM_CASE?

No.

@alerque
Copy link
Member

alerque commented Jan 17, 2022

I would be okay dropping the use of SCREAM_CASE, but I think we should keep the urgent verbose tone with the words "unsafe" and a negative "no", so --unsafe_no_sandbox. The only other alternative might be to split this into two flags and require both, e.g. --no-sandbox, but require a --unsafe flag to enable unsafe feature(s). If we think there might be more than one we want to warn about like this perhaps that would be best.

Copy link
Member

@alerque alerque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the option is fine, all in needs is a way to set it without screaming ;-)

#359 (comment)

@AntumDeluge
Copy link
Contributor Author

Changed UNSAFE_NO_SANDBOX to unsafe_no_sandbox.

@alerque alerque merged commit e40bc3f into lunarmodules:master May 2, 2023
@AntumDeluge AntumDeluge deleted the import branch May 8, 2023 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants