Skip to content

Feature: Enhanced Proxies - #1468

Open
Wunder-Wulfe wants to merge 1 commit into
CapsAdmin:developfrom
Wunder-Wulfe:feature/enhanced-proxies
Open

Feature: Enhanced Proxies#1468
Wunder-Wulfe wants to merge 1 commit into
CapsAdmin:developfrom
Wunder-Wulfe:feature/enhanced-proxies

Conversation

@Wunder-Wulfe

Copy link
Copy Markdown
  • Fixed blacklist to use frontier patterns instead of the previous pattern matching structure, which would erroneously detect statements like owner_velocity_forward() due to _for satisfying the previous [%s%p]for match. Now matches against %f[%a](for)%f[%A]

  • Enables additional compilation mode, allowing use of local variables, if statements, and return statements

    • Provides alternative ways of computing proxies optimally, by re-using calculation results, or short circuit evaluations / early exits via if statements
    • Prohibits function declarations, loops, and modification of global variables for security/safety reasons. Modifying, assigning to, or creating globals will result in an error
  • Improved readability / structure of expressions.lua code

    • Moved repetitive code into functions, and simplified logic
    • Additional logic moved into functions to make iteration and testing easier
Working Example

Proxy:

local r,g,b = 0,0,0

local walkspeed = sqrt(owner_velocity_forward()^2 + owner_velocity_right()^2)

r = (if_event "Grounded")

if walkspeed > 0.2 then
    g = 1
else
    g = 0
end

return r,g,b

GIF:
4425fdc4cd5520765e08a46e90468c45

Fixed commit to rebase correctly this time. Github desktop was breaking my repo.

* Fixed blacklist to use frontier patterns instead of the previous pattern matching structure, which would erroneously detect statements like `owner_velocity_forward()` due to `_for` satisfying the previous `[%s%p]for` match. Now matches against `%f[%a](for)%f[%A]`

* Enables additional compilation mode, allowing use of local variables, if statements, and return statements
  * Provides alternative ways of computing proxies optimally, by re-using calculation results, or short circuit evaluations / early exits via if statements
  * Prohibits function declarations, loops, and modification of global variables for security/safety reasons. Modifying, assigning to, or creating globals will result in an error

* Improved readability / structure of expressions.lua code
  * Moved repetitive code into functions, and simplified logic
  * Additional logic moved into functions to make iteration and testing easier
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.

1 participant