Sha256: 022c3542b764c10052cd20b31def71db959ed8d96fc3d71bd6eda2a8f52bec22

Contents?: true

Size: 903 Bytes

Versions: 4

Compression:

Stored size: 903 Bytes

Contents

#include "<%= @namespace.header %>"

#include "lua_cpp_helper.h"

using namespace <%= @namespace.name %>;

<% if @namespace.members; @namespace.members.each do |function| %>

<%= function %>

<% end; end %>

// Register namespace


static const struct luaL_Reg <%= @namespace.name %>_functions[] = {
<%= indent(functions_registration, 2) %>,
  {NULL, NULL},
};

<% if @namespace.has_constants? %>
static const struct lua_constants_Reg <%= @namespace.name %>_namespace_constants[] = {
<%= indent(constants_registration, 2) %>,
  {NULL, NULL},
};
<% end %>

void luaopen_<%= @namespace.lib_name %>(lua_State *L) {
  // register functions
  luaL_register(L, <%= @namespace.name.inspect %>, <%= @namespace.name %>_functions);
<% if @namespace.has_constants? %>
  // register namespace enums
  register_constants(L, <%= @namespace.id_name.inspect %>, <%= @namespace.name %>_namespace_constants);
<% end %>
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dub-0.6.1 lib/dub/lua/namespace.cpp.erb
dub-0.6.0 lib/dub/lua/namespace.cpp.erb
dub-0.5.1 lib/dub/lua/namespace.cpp.erb
dub-0.5.0 lib/dub/lua/namespace.cpp.erb