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 method for emplacing lua contracts from CLI #269

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

maurermi
Copy link
Collaborator

Adds a way to emplace lua contracts into parsec from the CLI

Potentially a useful development tool

@maurermi
Copy link
Collaborator Author

@madars

Adds a way to emplace lua contracts into parsec from the CLI

Potentially a useful development tool

Signed-off-by: Michael Maurer <[email protected]>
function gen_bytecode(func)
c = string.dump(func, true)
tot = ""
for i = 1, string.len(c) do
Copy link
Contributor

Choose a reason for hiding this comment

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

since strings are immutable, string concatenation in a for loop is generally discouraged due to inefficiency (it requires the creation of an entirely new string for each iteration).

It looks like Lua has a "string buffer" equivalent by using tables https://www.lua.org/pil/11.6.html and then just returning table.concat (PIL, pp. 110 and E 5.8 on pp. 41)

also it looks like you can just use the length operator # (PIL, pp. 24) rather than using a method call for the length

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.

2 participants