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

Support argument passing and return to do_file/string #191

Merged
merged 1 commit into from Jan 24, 2024
Merged

Conversation

Trey2k
Copy link
Member

@Trey2k Trey2k commented Jan 24, 2024

The lack of support for this was just an oversight. do_file and do_string will now take an optional second argument that should be an array of arguments. And now return a Variant instead of a LuaError.

Example

func _ready():
	var lua: LuaAPI = LuaAPI.new()
	lua.bind_libraries(["base", "table", "string"])

	var ret = lua.do_string("""
	local a, b = ...
	print(a, b)
	return a + b
	""", [4, 6])
	if ret is LuaError:
		print("ERROR %d: %s" % [ret.type, ret.message])
		return
	
	print(ret)

@Trey2k Trey2k merged commit edf4afe into main Jan 24, 2024
19 of 21 checks passed
@Trey2k Trey2k deleted the dev/file_ret branch January 24, 2024 18:48
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.

None yet

1 participant