[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Colon notation in object-oriented programming
- From: "Soni L." <fakedme@...>
- Date: Sun, 5 Mar 2017 13:57:54 -0300
On 05/03/17 01:53 PM, Petri Häkkinen wrote:
On Mar 5, 2017, at 4:26 PM, "Soni L." <email@example.com> wrote:
Here's a challenge for you:
Write an extensible game modding API, using only static non-replaceable functions, and without ever deferring to an object function inside them.
Sorry, I don't understand. What's an "object function" and "static non-replaceable function"? In Lua there is just one function type.
Also, I don't see how not using "self" would stop me from writing a modding API.
Write a modding API where you use
get_inventory_item(something, slot) -- aka a "static non-replaceable
And "get_inventory_item" cannot be replaced and you don't call a
function from "something" through it. So e.g. no
function get_inventory_item(something, slot)
return something.get_inventory_item(something, slot) -- aka an
And no having a lookup table to map objects to functions.
Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.